Avatar

Not applicable

hi

     my problem is

   i am trying to get usernames  which will be appearing in listbox in chat function but iam unable to get it so can any one help me how to get them

iam placing that code here

the code which is in red where i got stuck iam unable to get users name present in that list box so can any one hlep me

plzzzz it will be very usefull to as iam new to flex and the code is ruuning on (afcs) flex 3

<?xml version="1.0" encoding="utf-8"?>
<mx:Application layout="absolute"
    xmlns:mx="http://www.adobe.com/2006/mxml"
    applicationComplete="init()"
    xmlns:rtc="AfcsNameSpace">
   
    <mx:Script>
        <![CDATA[
            import com.adobe.rtc.sharedManagers.UserManager;
            import com.adobe.rtc.sharedManagers.descriptors.UserDescriptor;
            import mx.controls.listClasses.IListItemRenderer;
            import mx.controls.listClasses.ListBaseSelectionData;
            import mx.collections.IList;
            import mx.events.ItemClickEvent;
            import mx.controls.Alert;
            import com.adobe.rtc.events.AuthenticationEvent;
            import com.adobe.rtc.events.ConnectSessionEvent;
            import com.adobe.rtc.events.SessionEvent;
            import mx.core.IFlexDisplayObject;
            import mx.managers.PopUpManager;
            import flash.net.*;
            import mx.collections.ArrayCollection;
           
            private const applicationTitle:String = "AFCS Sample Application";
              [Bindable]
        
           public var cmd:UserManager=new UserManager;
           public var bharath:Array=new Array;
            private function init():void
            {
                sess.addEventListener(SessionEvent.ERROR, onEventNotification);
                sess.addEventListener(SessionEvent.SYNCHRONIZATION_CHANGE, onEventNotification);
                auth.addEventListener(AuthenticationEvent.AUTHENTICATION_FAILURE, onEventNotification);
                auth.addEventListener(AuthenticationEvent.AUTHENTICATION_SUCCESS, onEventNotification);
               
                popup(loginWindow);
            }
           
            private function popup(window:IFlexDisplayObject):void
            {
                PopUpManager.addPopUp(window, this, true);
                PopUpManager.centerPopUp(window);
                window.visible = true;
            }

            /**
             * Process AFCS Events
             */
            private function onEventNotification(p_event:Event):void
            {
                if (p_event.type == SessionEvent.SYNCHRONIZATION_CHANGE) {
                    if (sess.isSynchronized) {
                        //
                        // isSyncronized==true : we are connected to the room
                        //
                        panel.title = "Connected to room " + sess.roomURL;
                        PopUpManager.removePopUp(loginWindow);
                    } else {
                        //
                        // isSyncronized==false : we are disconnected from the room
                        //
                        panel.title = applicationTitle;
                        sess.roomURL = null;
                        notificationMessage.text = "";
                        popup(loginWindow);
                    }
                }
               
                else if (p_event.type == AuthenticationEvent.AUTHENTICATION_SUCCESS) {
                    //
                    // Authentication succeeded
                    //
                    notificationMessage.text = "Authentication Succeeded";
                }
               
                else if (p_event.type == AuthenticationEvent.AUTHENTICATION_FAILURE) {
                    //
                    // Authentication failed : bad password or invalid username
                    //
                    notificationMessage.text = "Authentication Failed";
                }
               
                else if (p_event.type == SessionEvent.ERROR) {
                    //
                    // Generic session error, but this can happen if you mispell the account/room names
                    // (sError.error.name == "INVALID_INSTANCE" and sError.error.message == "Invalid Instance")
                    //
                    var sError:SessionEvent = p_event as SessionEvent;
                    notificationMessage.text = sError.error.message;
                }
               
                else
                    notificationMessage.text = "Got event " + p_event;
            }
           
            private function login():void
            {
                notificationMessage.text = "";
                auth.userName = username.text;
                auth.password = passwordBox.visible ? password.text : null; // password==null : the user is a guest
                sess.roomURL = roomURL.text;       
                sess.login();
            }
           
            public function userclick(bharath):void
            {
                Alert.show(bharath)
            }
        ]]>
    </mx:Script>       
    <rtc:AdobeHSAuthenticator id="auth"/>       
    <rtc:RoomSettings id="settings" autoPromote="true"/>

    <mx:Panel id="panel" title="{applicationTitle}" width="100%" height="100%" paddingLeft="5" paddingTop="5" paddingRight="5" paddingBottom="5">
   
        <!--
         | Login Dialog Box
         -->
        <mx:TitleWindow id="loginWindow" title="Connect to Room" visible="false">
            <mx:VBox>
                <mx:HBox>
                    <mx:Label text="Room URL:" width="70"/>
                    <mx:TextInput id="roomURL" width="295" tabIndex="1">
                        <mx:text>http://connect.acrobat.com/exampleURL/exampleroom</mx:text>
                    </mx:TextInput>
                </mx:HBox>
                <mx:HBox>
                    <mx:Label text="Username:" width="70"/>
                    <mx:TextInput id="username" tabIndex="2">
                        <mx:text>guest</mx:text>
                    </mx:TextInput>           
                    <mx:Button label="Login" click="login()" width="126" tabIndex="4"/>
                </mx:HBox>
                <mx:HBox>
                    <mx:HBox id="passwordBox">
                    <mx:Label text="Password:" width="70"/>
                    <mx:TextInput id="password" displayAsPassword="true" tabIndex="3"/>
                    </mx:HBox>
                    <mx:RadioButton label="User" selected="true" click="passwordBox.visible = true"/>
                    <mx:RadioButton label="Guest" click="passwordBox.visible = false"/>
                </mx:HBox>
                <mx:Text id="notificationMessage" text=""/>
            </mx:VBox>
        </mx:TitleWindow>

        <!--
         | AFCS application UI wrapped in ConnectSession
         -->       
        <rtc:ConnectSessionContainer
            id="sess"
            authenticator="{auth}"
            initialRoomSettings="{settings}"
            autoLogin="false" width="100%" height="100%" >       
            <mx:HBox width="100%" height="100%" horizontalGap="0">
                <mx:VBox>
                    <mx:TabBar dataProvider="viewStack" direction="vertical" width="100" verticalGap="0"/>
                    <!--mx:Button label="Disconnect" click="sess.close()"/-->
                </mx:VBox>

                <mx:ViewStack id="viewStack" width="100%" height="100%" borderSides="left top right bottom" borderStyle="solid" borderThickness="2">
                    <!--
                     | Chat pod and roster
                     -->
                    <mx:HBox label="Chat" width="100%" height="100%">
                        <rtc:SimpleChat width="40%" height="100%"/>
                        <rtc:WebCamera left="0" right="0" top="0" bottom="0" width="40%" height="100%"/>
                        <mx:List alternatingItemColors="[#DFDFDF,#EEEEEE]" dataProvider="{sess.userManager.userCollection}" width="10%" height="100%" labelField="displayName" id="abc"  itemClick="userclick(sess.userManager.userCollection.list.toArray())"/>

                      
                     
                    </mx:HBox>
                    <!--
                     | Whiteboard pod
                     -->
                   
                   
                        <!-- for some strange reason the shapesToolBar starts outside the WhiteBoard canvas
                            so when the whiteBoard is created I move shapesToolBar back to where it should be
                        <rtc:SharedWhiteBoard id="wb" left="0" right="0" top="0" bottom="0"
                            creationComplete="wb.shapesToolBar.move(0,0)"/>
                    </mx:Canvas>-->
   
                    <!--
                     | Fileshare pod
                     -->
                    <mx:Canvas label="FileShare" width="100%" height="100%">
                        <rtc:FileShare left="0" right="0" top="0" bottom="0"/>
                    </mx:Canvas>
                </mx:ViewStack>
            </mx:HBox>
        </rtc:ConnectSessionContainer>
    </mx:Panel>
</mx:Application>