createRoom()

Availability:

Flash Player 6.0
SmartFoxServer Lite / Basic / Pro

Usage:

smartFox.createRoom(roomObj)

Description:

Dynamically create a new room in the current zone.

Parameters:

An object with the following properties:

name   the room name
password   a password for the room (optional)
maxUsers   the max. number of users for that room
maxSpectators   the max. number of spectator slots (only for game rooms )
isGame     a boolean, true if the game is a game room
exitCurrentRoom   a boolean value. It can be used when creating a new game room.
By default when a new game rooms is launched, its creator is auto-joined inside the room leaving the one he was in before. If you don't want to leave the old room you should set this property to false.
uCount   a boolean, indicating if the new room will receive the uCount update messages.
The uCount messages are updates about the number of users in each room of the zone. If you're not handling them in the current room it is reccomended to turn it off.
vars   an array of room variables (see below)

A Room can be initialized with any number of Room Variables. The variables parameter is an array of objects with these properties:

name   variable name
val   variable value
priv   boolean, true if the variable is private
persistent   boolean, true if the variable is persistent

Returns:

Nothing.

Example:

room = new Object

room.name = "The Cave"
room.isGame = true
room.maxUsers = 15

variables = new Array()
variables.push( {name:"ogres", val:5, priv:true} )
variables.push( {name:"skeletons", val:4} )

room.vars = variables

smartFox.createRoom(room)

See also:

onRoomAdded(), onCreateRoomError()