| Package | com.electrotank.electroserver5.api |
| Class | public class CreateRoomVariableRequest |
| Inheritance | CreateRoomVariableRequest EsRequest EsMessage flash.events.Event |
private var _es:ElectroServer;
private function initialize():void {
_es.engine.addEventListener(MessageType.RoomVariableUpdateEvent.name, onRoomVariableUpdateEvent);
testCreateRoomVariable();
}
private function testCreateRoomVariable():void {
//create the request object and populate with data
var crvr:CreateRoomVariableRequest = new CreateRoomVariableRequest();
crvr.name = "background";
crvr.value = new EsObject();
crvr.value.setString("music", "pop.mp3");
crvr.value.setString("color", "blue");
//send it
_es.engine.send(crvr);
}
private function onRoomVariableUpdateEvent(e:RoomVariableUpdateEvent):void {
var room:Room = _es.managerHelper.zoneManager.zoneById(e.zoneId).roomById(e.roomId);
var roomVar:RoomVariable;
switch (e.action) {
case RoomVariableUpdateAction.VariableCreated:
//the variable is already being managed in the room, so grab it
roomVar = room.roomVariableByName(e.name);
trace("Room variable created. Name: " + roomVar.name + ", value: " + roomVar.value.toString());
break;
case RoomVariableUpdateAction.VariableDeleted:
//the variable has already been deleted in the room, so for its name inspect the event object
trace("Room variable deleted. Name: " + e.name);
break;
case RoomVariableUpdateAction.VariableUpdated:
//the variable is being managed in the room, so grab it
roomVar = room.roomVariableByName(e.name);
trace("Room variable updated. Name: " + roomVar.name + ", value: " + roomVar.value.toString());
break;
}
}
| Property | Defined By | ||
|---|---|---|---|
| locked : Boolean
The locked value of the room variable. | CreateRoomVariableRequest | ||
![]() | messageNumber : int | EsMessage | |
![]() | messageType : MessageType | EsMessage | |
| name : String
Name of the room variable. | CreateRoomVariableRequest | ||
| persistent : Boolean
If true then the variable is only removed when manually deleted or when the room itself is removed. | CreateRoomVariableRequest | ||
![]() | requestId : int | EsMessage | |
| roomId : int
Id of the room that contains the room variable. | CreateRoomVariableRequest | ||
![]() | serverId : String | EsMessage | |
| value : EsObject
Value of the room variable. | CreateRoomVariableRequest | ||
| zoneId : int
Id of the zone that contains the room. | CreateRoomVariableRequest | ||
| Method | Defined By | ||
|---|---|---|---|
CreateRoomVariableRequest(m:MessageType = null, t:TBase = null) | CreateRoomVariableRequest | ||
fromThrift(t_:TBase):void [override] | CreateRoomVariableRequest | ||
newThrift():TBase [override] | CreateRoomVariableRequest | ||
toThrift():TBase [override] | CreateRoomVariableRequest | ||
| locked | property |
locked:BooleanThe locked value of the room variable. If locked the room variable cannot be modified until unlocked. It's cleanup behavior is unchanged.
public function get locked():Boolean public function set locked(value:Boolean):void| name | property |
name:StringName of the room variable.
public function get name():String public function set name(value:String):void| persistent | property |
persistent:BooleanIf true then the variable is only removed when manually deleted or when the room itself is removed. If false then the room variable is automatically removed when the user that crated it leaves the room.
public function get persistent():Boolean public function set persistent(value:Boolean):void| roomId | property |
roomId:intId of the room that contains the room variable.
public function get roomId():int public function set roomId(value:int):void| value | property |
value:EsObjectValue of the room variable.
public function get value():EsObject public function set value(value:EsObject):void| zoneId | property |
zoneId:intId of the zone that contains the room.
public function get zoneId():int public function set zoneId(value:int):void| CreateRoomVariableRequest | () | Constructor |
public function CreateRoomVariableRequest(m:MessageType = null, t:TBase = null)m:MessageType (default = null) | |
t:TBase (default = null) |
| fromThrift | () | method |
override public function fromThrift(t_:TBase):voidParameters
t_:TBase |
| newThrift | () | method |
override public function newThrift():TBaseReturnsTBase |
| toThrift | () | method |
override public function toThrift():TBaseReturnsTBase |