onRoomVariablesUpdate()

Availability:

Flash Player 7, 8
SmartFoxServer Basic / Pro

Usage:

smartFox.onRoomVariablesUpdate(roomObj:Room, changedVars:Array)

Description:

The event is fired when room variables are updated in a certain room. A client receives these notifications only from the room(s) where he's currently logged in.
To optimize bandwidth only the variables that changed are transmitted.

Parameters:

roomObj   The object of the room in which variables were updated
changedVars   An associative array with the names of the changed variables as keys
Also you can iterate through numeric indexes (0 to length) to get the names of the variables that were changed.

Returns:

nothing

Example:

smartFox.onRoomVariablesUpdate = function(roomObj:Room, changedVars:Object)
{
	// We're interested in seeing if the variable called "score" was changed
	if (changedVars["score"])
	{
		var variables:Object = roomObj.getVariables()
		trace("Current score: " + variables["score"])
	}
}

See also: