Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Changing userID

Level 3
Level 3

I have userID .../27
I hook up with userID .../26

But when this user loggs out his userID  is .../24 in p_evt.userDescriptor.userID:


        function onUserRemove(p_evt:UserEvent):void {
            debug("onUserRemove p_evt.userDescriptor.userID "+p_evt.userDescriptor.userID);

isnt that strange?

I see that the user exists twice. When I refresh the browser to disconnect the first time onUserRemove isnt called at al. After this refresh there is a twin user added. When I refresh again the first user is  removed and calls onUserRemove. And again there is no remove event of the use I'm acually hooked up with.


0 Replies

Not sure I understand the problem, but I suspect the browser refresh is the root cause: closing the browser (and I would guess refreshing the window) doesn't always send the correct events to the FlashPlayer so the player and/or our server may think the user is still connected, Refreshing multiple times may just give the server enough time to finally understand the user has been disconnected and remove it from the list.

Level 3
Level 3

1.I start my page

     a. user A is added.

2. I refresh the browser

     a. onUserRemove is NOT called

     b. user A stays connected.    

     c. user B is added.
3. I refresh the browser

     a. onUserRemove is called, but with the UserID of user A.

     b. user A is than deleted in onUserRemove

     c. user B stays connected.   

     d. user C is added.

This goes on forever leaving always 2 user per browser.

Level 10
Level 10

Hi there,

Have you tried waiting a minute or 2 between refreshes? Sometimes, the

browser will take a little time truly garbage-collecting the connection, and

it will fix itself within a couple of minutes.


Level 3
Level 3

the problem comes already after first single refresh.

the server doesnt recognise the refresh/logout/disconnect. but flash should receive an event no? mabe we can use a flash onTermination event to kill the user?

Level 10
Level 10

Sorry, what I'm saying is that the problem should fix itself after a small amount of time (2 minutes is usually more than enough). If you do catch events for the browser refreshing, you should be able to call logout() on the ConnectSession to force this.

Level 3
Level 3

yeah, I tried

            stage.addEventListener(Event.DEACTIVATE, onDeactivate);

but its only triggered when closing the debug window and not on refreshing or closing the browser.

I could store the UserID in a SharedObject and logout the prev user when logging in, but this method may be insecure no?