Expand my Community achievements bar.

SOLVED

How to listen for a user entering a room

Avatar

Former Community Member

How do you listen for when a user enters a room? In the following code, enterUser() does not get called if there is no user in the room already, but does get called if there is already a user in the room.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    xmlns:mx="http://www.adobe.com/2006/mxml"
    xmlns:rtc="AfcsNameSpace"
    layout="absolute"
    creationComplete="init()">
   
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import com.adobe.rtc.events.UserEvent;
           
            protected function init():void {
                cSession.userManager.addEventListener(UserEvent.USER_CREATE, enterUser);
            }   
           
            protected function enterUser(event:UserEvent):void {
                Alert.show("user entered!");
            }   
        ]]>
    </mx:Script>
       
    <rtc:ConnectSessionContainer id="cSession" roomURL="https://connectnow.acrobat.com/myaccount/myfirstroom"
        width="100%" height="100%" >
       
        <rtc:authenticator>
            <rtc:AdobeHSAuthenticator userName="Guest"/>
        </rtc:authenticator>
        <rtc:Roster width="250" height="250"/>
    </rtc:ConnectSessionContainer>

</mx:Application>

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

You don't get the event if you are the one who is entering. If anyone else enters, you will get the event. For your own, you can listen to UsetEvent.SYNCHRONIZATION_CHANGE to see that you have come in and syncd up.

Thanks

Hironmay Basu

View solution in original post

1 Reply

Avatar

Correct answer by
Former Community Member

You don't get the event if you are the one who is entering. If anyone else enters, you will get the event. For your own, you can listen to UsetEvent.SYNCHRONIZATION_CHANGE to see that you have come in and syncd up.

Thanks

Hironmay Basu

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----