sendObjectToGroup()
Availability:
Flash Player 7, 8
SmartFoxServer Lite / Basic / Pro
Usage:
smartFox.sendObjectToGroup(obj:Object, userList:Array, roomId:Number)
Description:
Sends an Actionscript object to one or more users, as specified
in the second parameter
Can be useful for sending complex/nested data structures to clients, like a game
move or a game status change.
Supported datatypes are: Strings, Booleans, Numbers, Arrays, Objects
Parameters:
obj | An object containing all data that you need to send. The Object can contain other objects, arrays etc... | |
userList | An array containing one or more recipient id | |
roomId | (optional) the id of the source room, if you are allowing users to join multiple rooms |
Returns:
Fires the onObjectReceived event
Example:
A simple object with primitive data is sent to the users with id = 1,2
move:Object = {} move.x = 150 move.y = 250 move.speed = 8 smartFox.sendObjectToGroup(move, [1, 2])
See also:
onObjectReceived