Packagecom.whirled.avrg
Classpublic class RoomSubControlBase
InheritanceRoomSubControlBase Inheritance TargetedSubControl Inheritance AbstractSubControl Inheritance AbstractControl Inheritance flash.events.EventDispatcher
SubclassesRoomSubControlClient, RoomSubControlServer

Provides AVR services for a single room to clients and server agents.



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
 Inherited
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server together.
AbstractSubControl
  
Gets all available information on the avatar of a player with the given id.
RoomSubControlBase
  
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
  
Gets an array of the ids of all the occupants in this room.
RoomSubControlBase
  
getOccupantName(playerId:int):String
Get the name of the specified occupant, who may be a player, or null if not found.
RoomSubControlBase
  
getPlayerIds():Array
Gets an array of the ids of all the players in this room.
RoomSubControlBase
  
getRoomBounds():Rectangle
Get the room's bounds in pixel coordinates.
RoomSubControlBase
  
getRoomId():int
Gets the id of this room.
RoomSubControlBase
  
getRoomName():String
Returns the name of this room.
RoomSubControlBase
  
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
  
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
Events
 EventSummaryDefined by
   Dispatched when something has changed about a player's avatar in this room.RoomSubControlBase
   Dispatched when a MOB has been created.RoomSubControlBase
   Dispatched when music starts playing in the room.RoomSubControlBase
   Dispatched when music stops playing in the room.RoomSubControlBase
   Dispatched either when somebody in this room entered our current game, or somebody playing the game entered this room.RoomSubControlBase
   Dispatched either when somebody in this room left our current game, or somebody playing the game left this room.RoomSubControlBase
   Dispatched when a player in this room takes up a new location.RoomSubControlBase
   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
Method detail
getAvatarInfo()method
public function getAvatarInfo(playerId:int):AVRGameAvatar

Gets all available information on the avatar of a player with the given id.

Parameters
playerId:int

Returns
AVRGameAvatar

Throws
— if the player is not here
getMusicOwnerId()method 
public function getMusicOwnerId():int

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.

Returns
int
getOccupantIds()method 
public function getOccupantIds():Array

Gets an array of the ids of all the occupants in this room. The occupants is a superset of the players.

Returns
Array
getOccupantName()method 
public function getOccupantName(playerId:int):String

Get the name of the specified occupant, who may be a player, or null if not found. NOTE: names are not unique and can change at any time. You must use the playerId to identify someone, and only retrieve the name for display purposes.

Parameters
playerId:int

Returns
String
getPlayerIds()method 
public function getPlayerIds():Array

Gets an array of the ids of all the players in this room. The players are a subset of the occupants.

Returns
Array
getRoomBounds()method 
public function getRoomBounds():Rectangle

Get the room's bounds in pixel coordinates. This is essentially the width and height of the room's decor. It is an absolute coordinate system, i.e. (x, y) for one client here is the same (x, y) as for another.

Returns
Rectangle — a Rectangle anchored at (0, 0)
getRoomId()method 
public 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
getRoomName()method 
public function getRoomName():String

Returns the name of this room.

Returns
String
getSpawnedMobs()method 
public function getSpawnedMobs():Array

Returns an array of Strings corresponding to the ids of all the MOBs in this room.

Returns
Array

See also

isPlayerHere()method 
public function isPlayerHere(id:int):Boolean

Tests if a player of a given id is in this room.

Parameters
id:int

Returns
Boolean
Event detail
avatarChangedevent 
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.AVATAR_CHANGED

Dispatched when something has changed about a player's avatar in this room.

An event type dispatched when something has changed about an avatar in the room.
name - not used
value :int - id of the player whose avatar changed

mobControlAvailableevent  
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.MOB_CONTROL_AVAILABLE

Dispatched when a MOB has been created.

An event type dispatched when the control for a MOB spawned in the room has become available.
name - the id of the MOB
value :MobSubControlBase - the new control

See also

musicStartedevent  
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.ControlEvent.MUSIC_STARTED

Dispatched when music starts playing in the room. If the current user can hear it, id3 data aybe available shortly after this event. The sequence of events goes like this: MUSIC_STARTED, 0 or more MUSIC_ID3 tags (client only), MUSIC_STOPPED. Note however that you may not get a MUSIC_STARTED event if the music starts playing prior to your avrg being initialized. Calling getMusicOwnerId() can tell you definitively if there is music currently playing.

An event dispatched when some music starts playing.
name - unused
value - unused

musicStoppedevent  
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.ControlEvent.MUSIC_STOPPED

Dispatched when music stops playing in the room.

An event dispatched when some music stops playing.
name - unused
value - unused

See also

playerEnteredevent  
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.PLAYER_ENTERED

Dispatched either when somebody in this room entered our current game, or somebody playing the game entered this room. On the client, the event is only dispatched if the player entering the room is not the local player. On the server agent, it is always dispatched.

An event type dispatched when a player entered the room.
name - not used
value :int - the id of the player entering

playerLeftevent  
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.PLAYER_LEFT

Dispatched either when somebody in this room left our current game, or somebody playing the game left this room. On the client, the event is only dispatched if the player leaving the room is not the local player. On the server agent, it is always dispatched.

An event type dispatched either when a player leaves the room.
name - not used
value :int - the id of the player leaving

playerMovedevent  
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.PLAYER_MOVED

Dispatched when a player in this room takes up a new location. The event is dispatched immediately when the move is initiated, not when the avatar arrives at the location. The movement itself may take a potentially long time.

An event type dispatched when a player of our game who's also in the room took up a new location.
name - not used
value :int - the id of the player who moved

signalReceivedevent  
Event object type: com.whirled.avrg.AVRGameRoomEvent
AVRGameRoomEvent.type property = com.whirled.avrg.AVRGameRoomEvent.SIGNAL_RECEIVED

Dispatched when a signal has been received in this room.

An event type dispatched when a signal has been received in this room.
name - The name of the signal.
value - The arg sent with the signal, or null.

See also