onUserCountChange()

Availability:

Flash Player 7, 8
SmartFoxServer Basic / Pro

Usage:

smartFox.onUserCountChange(roomObj:Room)

Description:

The event is fired when the number of users and/or spectators changes in a room within the same zone. This feature allows to keep track in realtime of the status of the other rooms in terms of users and spectators.

Also this functionality can be turned off to save bandwitdh, since a message is broadcasted each time a user enters or exits a room in the whole zone.
In case you're using many rooms in the zone and you're handling a medium to high traffic (for example 700-1000 clients) you could turn the feature off to reduce bandwidth consumption.

Check the configuration docs for more info about it.

Parameters:

roomObj   The object of the room where the user change occurred

Check the Room Class for more info on the objects returned.

Returns:

nothing

Example:

smartFox.onUserCountChange = function(roomObj:Room)
{
	// Assuming this is a game room
	
	var roomName:String = roomObj.getName()
	var roomUsers:Number = roomObj.getUserCount()
	var roomSpectators:Number = roomObj.getSpectatorCount()
	
	trace("Room " + roomName + "has " + roomUsers + " players and " + roomSpectators + " spectators")
}

See also: