Package | com.smartfoxserver.v2.requests |
Class | public class CreateRoomRequest |
Inheritance | CreateRoomRequest com.smartfoxserver.v2.requests.BaseRequest |
If the creation is successful, a roomAdd event is dispatched to all the users who subscribed the Group to which the Room is associated, including the Room creator. Otherwise, a roomCreationError event is returned to the creator's client.
See also
Method | Defined By | ||
---|---|---|---|
Creates a new CreateRoomRequest instance. | CreateRoomRequest |
CreateRoomRequest | () | Constructor |
public function CreateRoomRequest(settings:RoomSettings, autoJoin:Boolean = false, roomToLeave:Room = null)
Creates a new CreateRoomRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
Parameterssettings:RoomSettings — An object containing the Room configuration settings.
| |
autoJoin:Boolean (default = false ) — If true , the Room is joined as soon as it is created.
| |
roomToLeave:Room (default = null ) — A Room object representing the Room that should be left if the new Room is auto-joined.
|
See also
private function someMethod():void { sfs.addEventListener(SFSEvent.ROOM_ADD, onRoomCreated); sfs.addEventListener(SFSEvent.ROOM_CREATION_ERROR, onRoomCreationError); // Create a new chat Room var settings:RoomSettings = new RoomSettings("My Chat Room"); settings.maxUsers = 40; settings.groupId = "chats"; sfs.send(new CreateRoomRequest(settings)); } private function onRoomCreated(evt:SFSEvent):void { trace("Room created: " + evt.params.room); } private function onRoomCreationError(evt:SFSEvent):void { trace("Room creation failed: " + evt.params.errorMessage); }