Packagecom.whirled.avrg
Classpublic class RoomSubControlServer
InheritanceRoomSubControlServer Inheritance RoomSubControlBase Inheritance TargetedSubControl Inheritance AbstractSubControl Inheritance AbstractControl Inheritance flash.events.EventDispatcher
ImplementsMessageSubControl

Provides AVR services for a single room to server agents only.

See also

AVRServerGameControl.getRoom()


Public Properties
 PropertyDefined by
  props : PropertySubControl
[read-only] Accesses the properties for this room.
RoomSubControlServer
Public Methods
 MethodDefined by
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
AbstractControl
  
despawnMob(id:String):void
Destroys a previosuly spawned MOB in this room.
RoomSubControlServer
 Inherited
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server together.
AbstractSubControl
 Inherited
Gets all available information on the avatar of a player with the given id.
RoomSubControlBase
  
Gets a MOB previously spawned in this room with the given id.
RoomSubControlServer
 Inherited
Get the playerId of the owner of the currently playing music, aka the player who added it to the playlist, or 0 if there is no music currently playing.
RoomSubControlBase
 Inherited
Gets an array of the ids of all the occupants in this room.
RoomSubControlBase
 Inherited
getOccupantName(playerId:int):String
Get the name of the specified occupant, who may be a player, or null if not found.
RoomSubControlBase
 Inherited
getPlayerIds():Array
Gets an array of the ids of all the players in this room.
RoomSubControlBase
 Inherited
getRoomBounds():Rectangle
Get the room's bounds in pixel coordinates.
RoomSubControlBase
  
getRoomId():int
Gets the id of this room.
RoomSubControlServer
 Inherited
getRoomName():String
Returns the name of this room.
RoomSubControlBase
 Inherited
Returns an array of Strings corresponding to the ids of all the MOBs in this room.
RoomSubControlBase
 Inherited
Get the targetId on which this control operates.
TargetedSubControl
 Inherited
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just loaded up our SWF by itself?
AbstractSubControl
 Inherited
isPlayerHere(id:int):Boolean
Tests if a player of a given id is in this room.
RoomSubControlBase
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
AbstractControl
  
sendMessage(name:String, value:Object = null):void
Sends a message to all the players that are in the room.
RoomSubControlServer
  
sendSignal(name:String, value:Object = null):void
Sends a signal to all instances of all entities in the room.
RoomSubControlServer
  
spawnMob(id:String, name:String, x:Number, y:Number, z:Number):void
Creates a new MOB in this room.
RoomSubControlServer
Events
 EventSummaryDefined by
 Inherited Dispatched when something has changed about a player's avatar in this room.RoomSubControlBase
 Inherited Dispatched when a MOB has been created.RoomSubControlBase
 Inherited Dispatched when music starts playing in the room.RoomSubControlBase
 Inherited Dispatched when music stops playing in the room.RoomSubControlBase
 Inherited Dispatched either when somebody in this room entered our current game, or somebody playing the game entered this room.RoomSubControlBase
 Inherited Dispatched either when somebody in this room left our current game, or somebody playing the game left this room.RoomSubControlBase
 Inherited Dispatched when a player in this room takes up a new location.RoomSubControlBase
   Dispatched when a room has unloaded and is no longer accessible.RoomSubControlServer
 Inherited Dispatched when a signal has been received in this room.RoomSubControlBase
 Inherited Event.UNLOAD Dispatched when the SWF using this control has been unloaded.AbstractControl
Property detail
propsproperty
props:PropertySubControl  [read-only]

Accesses the properties for this room. Room properties marked as such will be persisted and restored whenever the room is occupied anew.

Implementation
    public function get props():PropertySubControl

See also

Method detail
despawnMob()method
public function despawnMob(id:String):void

Destroys a previosuly spawned MOB in this room.

Parameters
id:String

See also

getMobSubControl()method 
public function getMobSubControl(id:String):MobSubControlServer

Gets a MOB previously spawned in this room with the given id. Null is returned if there is no MOB with that id.

Parameters
id:String

Returns
MobSubControlServer
getRoomId()method 
public override function getRoomId():int

Gets the id of this room. Room ids are the same as scene ids and are the same each time the room is visited. They may also be used directly to access a scene (www.whirled.com/#world-s{sceneId}).

Returns
int
sendMessage()method 
public function sendMessage(name:String, value:Object = null):void

Sends a message to all the players that are in the room. Clients receive the message by listening for MESSAGE_RECEIVED on RoomSubControlClient.

Parameters
name:String
 
value:Object (default = null)

See also

sendSignal()method 
public function sendSignal(name:String, value:Object = null):void

Sends a signal to all instances of all entities in the room. The same size restrictions as EntityControl.sendSignal() apply here too.

Parameters
name:String
 
value:Object (default = null)

See also

spawnMob()method 
public function spawnMob(id:String, name:String, x:Number, y:Number, z:Number):void

Creates a new MOB in this room. The id identifies the instance of the MOB and the name specifies the type. The call will do nothing if a MOB already exists in this room with the given id. The coordinates specify the initial location of the MOB in room coordinates. The visual representation of the MOB is created on the clients using the client's sprite exporter callback.

Parameters
id:String
 
name:String
 
x:Number
 
y:Number
 
z:Number

See also

Event detail
roomUnloadedevent 
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.ROOM_UNLOADED

Dispatched when a room has unloaded and is no longer accessible. Note that once this has happened, any further API methods called (except getRoomId()) will throw errors and no further events will be dispatched on it. The purpose of this event is for local cleanup, deregistration of event listeners, clearing out data structures and the like.