Packagecom.whirled.avrg
Classpublic class GameSubControlBase
InheritanceGameSubControlBase Inheritance AbstractSubControl Inheritance AbstractControl Inheritance flash.events.EventDispatcher
SubclassesGameSubControlClient, GameSubControlServer

Provides AVR game services for server agents and clients.



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
  
getItemPacks():Array
Returns the set of all item packs available to this game as an array of objects with the following properties:
     ident - string identifier of item pack
     name - human readable name of item pack
     mediaURL - URL for item pack content
     
GameSubControlBase
  
getLevelPacks():Array
Returns the set of all level packs available to this game as an array of objects with the following properties:
     ident - string identifier of item pack
     name - human readable name of item pack
     mediaURL - URL for item pack content
     premium - boolean indicating that content is premium or not
     
GameSubControlBase
  
getOccupantName(playerId:int):String
Get the name of an occupant of the game, or null if not found.
GameSubControlBase
  
getParty(partyId:int):PartySubControl
Get the party control for the specified party.
GameSubControlBase
  
getPartyIds():Array
Return the ids of all parties presently in this game.
GameSubControlBase
  
getPlayerIds():Array
Returns an array of the ids of all players who have joined and not yet quit the game.
GameSubControlBase
 Inherited
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just loaded up our SWF by itself?
AbstractSubControl
  
loadItemPackData(ident:String, onLoaded:Function, onFailure:Function):void
Loads the binary data for the item pack with the specified ident.
GameSubControlBase
  
loadLevelPackData(ident:String, onLoaded:Function, onFailure:Function):void
Loads the binary data for the level pack with the specified ident.
GameSubControlBase
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
AbstractControl
Events
 EventSummaryDefined by
   Dispatched when a message arrives with information that is not part of the shared game state.GameSubControlBase
   Dispatched when a party arrives in the game.GameSubControlBase
   Dispatched when a party leaves the game.GameSubControlBase
 Inherited Event.UNLOAD Dispatched when the SWF using this control has been unloaded.AbstractControl
Method detail
getItemPacks()method
public function getItemPacks():Array

Returns the set of all item packs available to this game as an array of objects with the following properties:

     ident - string identifier of item pack
     name - human readable name of item pack
     mediaURL - URL for item pack content
     

Returns
Array
getLevelPacks()method 
public function getLevelPacks():Array

Returns the set of all level packs available to this game as an array of objects with the following properties:

     ident - string identifier of item pack
     name - human readable name of item pack
     mediaURL - URL for item pack content
     premium - boolean indicating that content is premium or not
     

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

Get the name of an occupant of the game, or null if not found. In an AVRG all occupants are players, so this could be called getPlayerName(), but this name matches RoomSubControlBase as well as the "regular" game api. 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
getParty()method 
public function getParty(partyId:int):PartySubControl

Get the party control for the specified party. Note that this will always return a PartySubControl, even for partyIds that are not present in the game. Be careful.

Parameters
partyId:int

Returns
PartySubControl
getPartyIds()method 
public function getPartyIds():Array

Return the ids of all parties presently in this game.

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

Returns an array of the ids of all players who have joined and not yet quit the game.

Returns
Array
loadItemPackData()method 
public function loadItemPackData(ident:String, onLoaded:Function, onFailure:Function):void

Loads the binary data for the item pack with the specified ident.

Parameters
ident:String — the identifier of the item pack to be loaded.
 
onLoaded:Function — a function with the signature: function (data :ByteArray) :void that will be called with the item pack data if it loads successfully.
 
onFailure:Function — a function with the signature: function (error :Error) :void that will be called if the pack loading fails.
loadLevelPackData()method 
public function loadLevelPackData(ident:String, onLoaded:Function, onFailure:Function):void

Loads the binary data for the level pack with the specified ident.

Parameters
ident:String — the identifier of the level pack to be loaded.
 
onLoaded:Function — a function with the signature: function (data :ByteArray) :void that will be called with the level pack data if it loads successfully.
 
onFailure:Function — a function with the signature: function (error :Error) :void that will be called if the pack loading fails.
Event detail
MsgReceivedevent 
Event object type: com.whirled.net.MessageReceivedEvent
MessageReceivedEvent.type property = com.whirled.net.MessageReceivedEvent.MESSAGE_RECEIVED

Dispatched when a message arrives with information that is not part of the shared game state.

The type of all MessageReceivedEvents.

See also

partyEnteredevent  
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.party.PartySubControl.PARTY_ENTERED

Dispatched when a party arrives in the game.

An event type dispatched on the GameSubControl when a party joins the game.
name - not used
value - partyId

partyLeftevent  
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.party.PartySubControl.PARTY_LEFT

Dispatched when a party leaves the game.

An event type dispatched on the GameSubControl when a party leaves the game.
name - not used
value - partyId