Packagecom.electrotank.electroserver4.message.request
Classpublic class DeleteRoomVariableRequest
InheritanceDeleteRoomVariableRequest Inheritance com.electrotank.electroserver4.message.request.RequestImpl

This class allows you to delete a room variable for a room that you are in. A locked room variable can still be deleted.


Example
This example shows how to delete a room variable and capture the event. The event is fired when a variable is created, updated, or deleted.
     import com.electrotank.electroserver4.ElectroServer;
    import com.electrotank.electroserver4.entities.RoomVariable;
    import com.electrotank.electroserver4.esobject.EsObject;
    import com.electrotank.electroserver4.message.event.RoomVariableUpdateEvent;
    import com.electrotank.electroserver4.message.MessageType;
    import com.electrotank.electroserver4.message.request.DeleteRoomVariableRequest;
    import com.electrotank.electroserver4.room.Room;    
    //
    var es:ElectroServer;//Assume this was created, connection established, and login established already
    var myRoom:Room;//A reference to some room you are in.
    //
    function init():void {
        es.addEventListener(MessageType.RoomVariableUpdateEvent, "onRoomVariableUpdateEvent", this);
    }
    function deleteRoomVariable():void {
        var drr:DeleteRoomVariableRequest = new DeleteRoomVariableRequest();
        drr.setName("MusicInfo");
        drr.setRoomId(myRoom.getRoomId());
        drr.setZoneId(myRoom.getZone().getZoneId());
        //
        es.send(drr);
    }
    function onRoomVariableUpdateEvent(e:RoomVariableUpdateEvent):void {
        //name of the variable affected
        var varName:String = e.getName();
        //reference to the room that holds the variable
        var room:Room = es.getZoneManager().getZoneById(e.getZoneId()).getRoomById(e.getRoomId());
        trace("Room variable name: "+varName);
        switch (e.getUpdateAction()) {
            case RoomVariableUpdateEvent.VariableCreated:
                trace("Variable created");
                var rv:RoomVariable = room.getRoomVariable(name);
                trace("Room variable value: "+rv.getValue());//Will just trace out an object reference of the EsObject;
                break;
            case RoomVariableUpdateEvent.VariableUpdated:
                trace("Variable updated");
                var rv:RoomVariable = room.getRoomVariable(name);
                trace("Room variable value: "+rv.getValue());//Will just trace out an object reference of the EsObject;
                break;
                break;
            case RoomVariableUpdateEvent.VariableDeleted:
                trace("Variable deleted");
                break;
            default:
                trace("Action not handled: "+e.getUpdateAction());
                break;
        }
    }
    init();
    deleteRoomVariable();
    



Public Methods
 MethodDefined by
  
Creates a new instance of the DeleteRoomVariableRequest class.
DeleteRoomVariableRequest
  
getName():String
The name of the room variable to delete.
DeleteRoomVariableRequest
  
getRoomId():Number
The id of the room that contains the room variable.
DeleteRoomVariableRequest
  
getZoneId():Number
The id of the zone that contains the room.
DeleteRoomVariableRequest
  
setName(name:String):void
The name of the room variable to delete.
DeleteRoomVariableRequest
  
setRoomId(rId:Number):void
The id of the room that contains the room variable.
DeleteRoomVariableRequest
  
setZoneId(zId:Number):void
The id of the zone that contains the room.
DeleteRoomVariableRequest
  
DeleteRoomVariableRequest
Constructor detail
DeleteRoomVariableRequest()constructor
public function DeleteRoomVariableRequest()

Creates a new instance of the DeleteRoomVariableRequest class.

Method detail
getName()method
public function getName():String

The name of the room variable to delete.

Returns
String — Returns the name of the room variable to delete.
getRoomId()method 
public function getRoomId():Number

The id of the room that contains the room variable.

Returns
Number — The id of the room that contains the room variable.
getZoneId()method 
public function getZoneId():Number

The id of the zone that contains the room.

Returns
Number — The id of the zone that contains the room.
setName()method 
public function setName(name:String):void

The name of the room variable to delete.

Parameters
name:String — Name of the room variable to delete.
setRoomId()method 
public function setRoomId(rId:Number):void

The id of the room that contains the room variable.

Parameters
rId:Number — The id of the room that contains the room variable.
setZoneId()method 
public function setZoneId(zId:Number):void

The id of the zone that contains the room.

Parameters
zId:Number — The id of the zone that contains the room.
validate()method 
public override function validate():ValidationResponse

Returns
ValidationResponse