onUserLeave() question

You think you've found a bug? Please report it here.

Moderators: Lapo, Bax

Post Reply
mr_malee
Posts: 29
Joined: 08 Jun 2007, 03:21

onUserLeave() question

Post by mr_malee »

Ignore me

problem was i was trying to access a user object from params in the SFSEvent object

turns out the params back from a onUserLeaveRoom event are different than that of onUserEnterRoom

since i was accessing an undefined variable before populating my list it stopped the code from running.

Why are there so many different params for events?

like:
onUserCountChange

Dispatched when the user/spectator count of a room changed.

The params object contains the following parameters.

* room:Room - the Room object representing the room where the change occurred.

onUserEnterRoom

Dispatched when a user joins the current room.

The params object contains the following parameters.

* roomId:int - the id of the room joined by a user.
* user:User - the User object representing the user that joined the room.

onUserLeaveRoom

Dispatched when a user leaves the current room.

The params object contains the following parameters.

* roomId:int - the id of the room left by the user.
* userId:int - the id of the user that left the room (or got disconnected).
* userName:String - the name of the user.
shouldn't you just pass a room object and a user object?[/quote]
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Post by Lapo »

in the case of the userLeaveRoom, the user object doesn't exist anymore when you get the event.
Since there are many asynchronous events going on we preferred to pass ids instead of objects in certain situations to avoid the risk of passing null references.
This could open an endless debate... but in the end this is the solution we preferred :)
Lapo
--
gotoAndPlay()
...addicted to flash games
Post Reply