Package | com.whirled.game |
Class | public class LocalSubControl |
Inheritance | LocalSubControl ![]() ![]() ![]() |
Method | Defined by | ||
---|---|---|---|
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
| LocalSubControl | ||
clearScores(clearValue:Object = null, sortValuesToo:Boolean = false):void
Clear all the scores displayed in the occupants list.
| LocalSubControl | ||
![]() |
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server
together.
| AbstractSubControl | |
feedback(msg:String):void
Display a feedback chat message for the local player only, no other players
or observers will see it.
| LocalSubControl | ||
filter(text:String):String
Run the specified text through the user's chat filter.
| LocalSubControl | ||
getHeadShot(occupantId:int):DisplayObject
Return the headshot for the given occupant in the form of a DisplayObject.
| LocalSubControl | ||
getInviterMemberId():int
Retrieves the ID of the member who invited the current player to this game (using the page
shown by
showInvitePage . | LocalSubControl | ||
getInviteToken():String
Retrieves the token, if any, that was used to launch the game.
| LocalSubControl | ||
getSize():Point
Get the size of the game area, expressed as a Point
(x = width, y = height).
| LocalSubControl | ||
![]() |
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just
loaded up our SWF by itself?
| AbstractSubControl | |
isEmbedded():Boolean
Is the game being played in a "Whirled embed"?
| LocalSubControl | ||
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
| LocalSubControl | ||
setFrameRate(frameRate:Number = 30):void
Set the frame rate to use in your game.
| LocalSubControl | ||
setMappedScores(scores:Object):void
Set score or sortValue values for occupants.
| LocalSubControl | ||
setOccupantsLabel(label:String):void
Set a label to be shown above the occupants list in the game.
| LocalSubControl | ||
setPlayerScores(scores:Array, sortValues:Array = null):void
Set scores for seated players.
| LocalSubControl | ||
setStageQuality(quality:String = "medium"):void
Set the stage quality to use in your game.
| LocalSubControl | ||
showAllGames():void
Opens the web page for all the games at whirled.
| LocalSubControl | ||
showGameLobby(multiplayerOnly:Boolean = true):void
Opens the game's multiplayer lobby on this player's machine.
| LocalSubControl | ||
showGameShop(itemType:String, catalogId:int = 0):void
Opens the web page for this game's shop.
| LocalSubControl | ||
showInvitePage(defmsg:String, token:String = ""):void
Instructs the game client to open the game invite page, allowing the player to invite friends
to play this game.
| LocalSubControl | ||
showPage(token:String):Boolean
Shows the Whirled page identified by the supplied token.
| LocalSubControl | ||
showTrophies():void
Opens a popup displaying the trophies awarded by this game.
| LocalSubControl |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when a key is pressed when the game has focus. | LocalSubControl | |||
Dispatched when a key is released when the game has focus. | LocalSubControl | |||
Dispatched if the game lobby is closed. | LocalSubControl | |||
Dispatched when the size of the game area changes. | LocalSubControl | |||
![]() | Event.UNLOAD Dispatched when the SWF using this control has been unloaded. | AbstractControl |
addEventListener | () | method |
public override function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
|
priority:int (default = 0 )
|
|
useWeakReference:Boolean (default = false )
|
clearScores | () | method |
public function clearScores(clearValue:Object = null, sortValuesToo:Boolean = false):void
Clear all the scores displayed in the occupants list. Note: this function changes local display only; other clients will not be affected.
ParametersclearValue:Object (default = null ) — a value to set all the scores to, or null to not show anything.
|
|
sortValuesToo:Boolean (default = false ) — if true, also clear the sort values, returning the list
to the default sort order.
|
feedback | () | method |
public function feedback(msg:String):void
Display a feedback chat message for the local player only, no other players or observers will see it.
Parametersmsg:String |
filter | () | method |
public function filter(text:String):String
Run the specified text through the user's chat filter. This is optional, you can use it to clean up user-entered text.
Parameterstext:String |
String — the filtered text, or null if it was so bad it's gone.
|
getHeadShot | () | method |
public function getHeadShot(occupantId:int):DisplayObject
Return the headshot for the given occupant in the form of a DisplayObject. The objects are now otcached in the backend, so each request will return a brand new headshot. You should save a reference to these in your game if you will be re-using headshots, but now you may also get two headshots for the same player if you want to display them in two places. The DisplayObject returned is always 80x60 pixels large. If the player's actual headshot is smaller than 80x60, it will be centered inside the 80x60 area. Note: There is a weird flash security issue/bug that may prevent you from removing this object from a parent. addChild(headshot) works, removeChild(headshot) works, but calling getChildAt(index) or removeChildAt(index) using the index of the headshot will throw a security error. Weird!
ParametersoccupantId:int — the player for which to get a headshot.
|
DisplayObject |
getInviterMemberId | () | method |
public function getInviterMemberId():int
Retrieves the ID of the member who invited the current player to this game (using the page
shown by showInvitePage
. Returns 0 if the player did not start the game via an
invite link.
int |
getInviteToken | () | method |
public function getInviteToken():String
Retrieves the token, if any, that was used to launch the game. If the player entered into the game via a URL that contained a token (provided by the game via showInvitePage), this will return that token, otherwise null. Note that the invitations are not managed securely, it would be trivial for someone to modify a URL to specify a different token, so appropriate checks should be made.
ReturnsString |
getSize | () | method |
public function getSize():Point
Get the size of the game area, expressed as a Point (x = width, y = height).
ReturnsPoint |
isEmbedded | () | method |
public function isEmbedded():Boolean
Is the game being played in a "Whirled embed"?
ReturnsBoolean — true if the game is being played on some 3rd-party site, or false if
on whirled.com or in the game testing environment.
|
removeEventListener | () | method |
public override function removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
Parameterstype:String |
|
listener:Function |
|
useCapture:Boolean (default = false )
|
setFrameRate | () | method |
public function setFrameRate(frameRate:Number = 30):void
Set the frame rate to use in your game. The default is 30fps, the same frame rate used in whirled rooms. The actual frame rate may be bounded on the lower end (for example, we may not let it go lower than 15fps) so that the rest of the user interface doesn't become annoying or unusable.
ParametersframeRate:Number (default = 30 )
|
setMappedScores | () | method |
public function setMappedScores(scores:Object):void
Set score or sortValue values for occupants. You may want to call clearScores prior to using this method to ensure that occupants that you don't specify are cleared out. You may use this method to update the "score" and sorting value for any subset of occupants in the game. You can update the score for one player having their occupantId as the only key. You can even set a "score" for any watchers. Note: this function changes local display only; other clients will not be affected.
Parametersscores:Object — an Object mapping occupantId to a score value (which may be a String or
numeric), or to a two-dimensional array containing the score value and the sortValue.
|
setOccupantsLabel | () | method |
public function setOccupantsLabel(label:String):void
Set a label to be shown above the occupants list in the game. Set to null to remove the label. Note: this function changes local display only; other clients will not be affected.
Parameterslabel:String |
setPlayerScores | () | method |
public function setPlayerScores(scores:Array, sortValues:Array = null):void
Set scores for seated players. Note: this function changes local display only; other clients will not be affected.
Parametersscores:Array — an array of 'score' values that must correspond to the seated players.
The scores may be numeric or String and will be displayed after the player names.
|
|
sortValues:Array (default = null ) — an array of sorting values that must correpond to the seated players.
If not specified then the scoreValues are used to sort the occupants list.
|
setStageQuality | () | method |
public function setStageQuality(quality:String = "medium"):void
Set the stage quality to use in your game. The default is MEDIUM, the same quality used in whirled rooms.
Parametersquality:String (default = "medium ")
|
showAllGames | () | method |
public function showAllGames():void
Opens the web page for all the games at whirled. (Does nothing in the test environment)
showGameLobby | () | method |
public function showGameLobby(multiplayerOnly:Boolean = true):void
Opens the game's multiplayer lobby on this player's machine. Please note this is only meaningful for games that support multiplayer.
ParametersmultiplayerOnly:Boolean (default = true ) — Optional parameter: if this game supports both single- and
multi-player games, a true value will only show multiplayer options (create table
or join existing tables), and a false value will show the default
single- and multi-player options. Default value is true.
|
showGameShop | () | method |
public function showGameShop(itemType:String, catalogId:int = 0):void
Opens the web page for this game's shop. The game will be shrunk to sidebar width while the game shop is showing.
ParametersitemType:String — the type of item to select by default. Valid constants are defined in
GameControl.
|
|
catalogId:int (default = 0 ) — the catalog id of a specific item to show or 0 to display the overview page
of all items of the specified type.
|
showInvitePage | () | method |
public function showInvitePage(defmsg:String, token:String = ""):void
Instructs the game client to open the game invite page, allowing the player to invite friends to play this game.
Parametersdefmsg:String — Default message that will be included along with the game's URL when sent
to the player's friends.
|
|
token:String (default = " ") — Optional token that will be included on the URL and eventually passed back to
the game when an invited friend goes to the URL. This allows the game to start in
a different state than usual.
|
showPage | () | method |
public function showPage(token:String):Boolean
Shows the Whirled page identified by the supplied token.
Parameterstoken:String — the token that identifies the page to be shown. This is not the full
URL, just the part after http://www.whirled.com/#. For example: passing "me" would show the
Me page. Passing "shop-l_5_343" would show the shop page for the Kawaii Knight avatar.
|
Boolean — true if the page was shown, false if it could not be shown for some reason.
|
showTrophies | () | method |
public function showTrophies():void
Opens a popup displaying the trophies awarded by this game.
keyDown | event |
flash.events.KeyboardEvent
Dispatched when a key is pressed when the game has focus.
keyUp | event |
flash.events.KeyboardEvent
Dispatched when a key is released when the game has focus.
LobbyClosed | event |
SizeChanged | event |
com.whirled.game.SizeChangedEvent
com.whirled.game.SizeChangedEvent.SIZE_CHANGED
Dispatched when the size of the game area changes.
The type of this event.