setUserVariables()

Availability:

Flash Player 7, 8
SmartFoxServer Lite / Basic / Pro

Usage:

smartFox.setUserVariables(varObj:Object, roomId:Number)

Description:

Stores data on the server side. When you set/update/delete one or more User Variables all the other users in the room will be notified. User variables are usefull to store user profile data that can be shared across other users.

Parameters:

varObj   an object containing the variables to save
roomId   (optional) the id of the source room, if you are allowing users to join multiple rooms

Allowed datatypes are Strings, Numbers, Booleans.
If a User Variable is set to null it is going to be deleted from the server.

User variables are destroyed when the user logs out or gets disconnected.

Returns:

Fires the onUserVariablesUpdate event

Example:

Example #1
in an avatar chat you could save the user profile (avatar name and position) like this:

var uVars:Object = new Object()
uVars.myAvatar = "Homer"
uVars.posx = 100
uVars.posy = 200

smartFox.setUserVariables(uVars)


User variables are broadcasted to all other users in the same room.

See also:

onUserVariablesUpdate