Package | com.whirled |
Class | public class AvatarControl |
Inheritance | AvatarControl ![]() ![]() ![]() ![]() |
Method | Defined by | ||
---|---|---|---|
AvatarControl(disp:DisplayObject)
Create an AvatarControl.
| AvatarControl | ||
![]() |
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
| AbstractControl | |
![]() |
canManageRoom(memberId:int = 0):Boolean
Returns true if the local client has management privileges in the current room.
| EntityControl | |
![]() |
clearPopup():void
Clear any showing popup.
| EntityControl | |
![]() |
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server
together.
| AbstractControl | |
![]() |
getCamera(index:String = null):Camera
Access the local user's camera.
| EntityControl | |
![]() |
getDefaultDataPack():ByteArray
Get the default datapack for this entity, or null if there is none defined.
| EntityControl | |
![]() |
getEntityIds(type:String = null):Array
Enumerates the ids of all entities in this room.
| EntityControl | |
![]() |
getEntityProperty(key:String, entityId:String = null):Object
Looks up and returns the specified property for the specified entity.
| EntityControl | |
![]() |
getEnvironment():String
Get the "environment" in which this entity is presently running.
| EntityControl | |
![]() |
getInstanceId():int
Get the id of the viewer that is viewing this instance.
| EntityControl | |
![]() |
getLogicalLocation():Array
Returns our current logical location in the scene.
| EntityControl | |
![]() |
getMemories():Object
Return an associative hash of all the memories.
| EntityControl | |
![]() |
getMemory(key:String, defval:Object = null):Object
Returns the value associated with the supplied key in this item's memory.
| EntityControl | |
![]() |
getMicrophone(index:int = -1):Microphone
Access the local user's microphone.
| EntityControl | |
![]() |
getMusicId3():Object
Get the id3 metadata of the currently playing music.
| EntityControl | |
![]() |
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.
| EntityControl | |
![]() |
getMyEntityId():String
Returns the Whirled-wide unique ID of this copy of the entity.
| EntityControl | |
![]() |
getOrientation():Number
Returns the current orientation of this mobile.
| ActorControl | |
![]() |
getPixelLocation():Array
Returns our current location in the scene, in pixel coordinates.
| EntityControl | |
![]() |
getRoomBounds():Array
Get the room's bounds in pixels.
| EntityControl | |
getState():String
Get the current state.
| AvatarControl | ||
![]() |
getViewerName(id:int = 0):String
Get the non-unique display name of the user viewing a particular instance.
| EntityControl | |
![]() |
hasControl():Boolean
Detects whether this client is in control.
| EntityControl | |
![]() |
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just
loaded up our SWF by itself?
| AbstractControl | |
![]() |
isMoving():Boolean
Returns whether the mobile is currently moving between locations in the scene.
| ActorControl | |
isSleeping():Boolean
Detects whether this avatar is sleeping.
| AvatarControl | ||
registerActions(... actions):void
Register the named actions that can be used to animate the avatar.
| AvatarControl | ||
![]() |
registerCustomConfig(func:Function):void
Register a function used for generating a custom config panel.
| EntityControl | |
![]() |
registerPropertyProvider(func:Function):void
Registers a function that provides custom entity properties.
| EntityControl | |
registerStates(... states):void
Register named states that can be selected by the wearer of this avatar.
| AvatarControl | ||
![]() |
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
| AbstractControl | |
![]() |
sendMessage(name:String, arg:Object = null):void
Send a message to other instances of this entity, resulting in a MESSAGE_RECEIVED event.
| EntityControl | |
![]() |
sendSignal(name:String, arg:Object = null):void
Send a message to all instances of all entities in this instance's current room,
resulting in a SIGNAL_RECEIVED event.
| EntityControl | |
![]() |
setHotSpot(x:Number, y:Number, height:Number):void
Set the layout "hotspot" for your item, specified as pixels relative to (0, 0) the top-left
coordinate.
| EntityControl | |
![]() |
setLogicalLocation(x:Number, y:Number, z:Number, orient:Number):void
Requests that our location be updated.
| ActorControl | |
![]() |
setMemory(key:String, value:Object, callback:Function = null):void
Requests that this item's memory be updated with the supplied key/value pair.
| EntityControl | |
![]() |
setMoveSpeed(pixelsPerSecond:Number):void
Set this actor's movement speed, in pixels per second.
| ActorControl | |
![]() |
setOrientation(orient:Number):void
Requests that our orientation be updated.
| ActorControl | |
![]() |
setPixelLocation(x:Number, y:Number, z:Number, orient:Number):void
Requests that our location be updated.
| ActorControl | |
setPreferredY(pixels:int):void
Set this avatar's preferred height off the ground, in pixels.
| AvatarControl | ||
![]() |
setState(state:String):void
Set the state of this actor.
| ActorControl | |
![]() |
setTickInterval(interval:Number):void
Configures the interval on which this item is "ticked" in milliseconds.
| EntityControl | |
![]() |
showPopup(title:String, panel:DisplayObject, width:Number, height:Number, backgroundColor:uint = 0xFFFFFF, backgroundAlpha:Number = 1.0):Boolean
Show a popup to the current user in the whirled.
| EntityControl | |
![]() |
triggerAction(name:String, arg:Object = null):void
Triggers an action on this scene object.
| EntityControl |
Event | Summary | Defined by | ||
---|---|---|---|---|
Dispatched when the user or game controlling this avatar triggers an action. | AvatarControl | |||
![]() | Dispatched when the instance in control sends a trigger action to all instances. | EntityControl | ||
![]() | Dispatched as notification that the actor's appearance has changed. | ActorControl | ||
Dispatched when the user controlling this avatar speaks. | AvatarControl | |||
![]() | Dispatched to entities when they overhear chatter in the room. | EntityControl | ||
![]() | Dispatched when this instance gains control. | EntityControl | ||
![]() | Dispatched when an entity enters the room. | EntityControl | ||
![]() | Dispatched when an entity leaves the room. | EntityControl | ||
![]() | Dispatched when an entity in the room (other than the listening entity) changes location. | EntityControl | ||
![]() | Dispatched when the instance in control updates the memory of this digital item. | EntityControl | ||
![]() | Dispatched when any instance sends a message to all instances. | EntityControl | ||
![]() | Dispatched when id3 data is found in the currently playing song. | EntityControl | ||
![]() | Dispatched when music starts playing in the room. | EntityControl | ||
![]() | Dispatched when music stops playing in the room. | EntityControl | ||
![]() | Dispatched when any entity or AVR game sends a message to all other entities. | EntityControl | ||
![]() | Dispatched as notification that the actor's state has changed. | ActorControl | ||
![]() | Dispatched once per tick, only when this instance has control and only if tick interval is registered. | EntityControl | ||
![]() | Event.UNLOAD Dispatched when the SWF using this control has been unloaded. | AbstractControl |
AvatarControl | () | constructor |
public function AvatarControl(disp:DisplayObject)
Create an AvatarControl.
Parametersdisp:DisplayObject — A display object from your hierarchy. Must be on the stage.
Typical usage: var ctrl :AvatarControl = new AvatarControl(this); |
getState | () | method |
public override function getState():String
Get the current state. If no state has been set or the control is not connected to whirled, null will be returned.
ReturnsString |
isSleeping | () | method |
public function isSleeping():Boolean
Detects whether this avatar is sleeping. An avatar is sleeping either when a user has intentially gone AFK (away from keyboard) or have let their client go idle, and zzz's appear over their head. You may react to isSleeping (if you want) to render a sleep state, or transition to an unregistered state that looks like sleeping.
Whenever this value changes an APPEARANCE_CHANGED event will be generated.
ReturnsBoolean |
registerActions | () | method |
public function registerActions(... actions):void
Register the named actions that can be used to animate the avatar. Actions are "one-time" events that cause the avatar to do something in the whirled, like laugh, play a sound, or do a quick animation. Actions are different from states- states are persistent and do not go away if you walk, talk, or play actions. These registered actions will show up in a menu from which the wearer of this avatar can select an action. Note, however, that you can fire unregistered actions as well. Note: actions must be 64 characters or less.
Parameters... actions |
registerStates | () | method |
public function registerStates(... states):void
Register named states that can be selected by the wearer of this avatar.
States are persistent. An actor may only be in one state at a time. If the actor is in a state and then needs to walk, talk, or play an action, then it should still be in the state during and after those actions.
When an actor is first instantiated, it is in the normal state. If no states are registered then there is an implicit unnamed normal state.
States are different from actions- actions are not persistent and are instantly forgotten as soon as you play them. If an action is a laugh animation that plays for 5 seconds, someone who walks in the room 1 second after you laugh will see nothing.
The first registered state will be your "default" state. If you call getState() without registering states you will get null.
Note: states must be 64 characters or less.
Parameters... states |
setPreferredY | () | method |
public function setPreferredY(pixels:int):void
Set this avatar's preferred height off the ground, in pixels. If unset, it defaults to 0, meaning that it walks on the ground.
Calling this does not adjust the current location.
Parameterspixels:int |
actionTriggered | event |
com.whirled.ControlEvent
com.whirled.ControlEvent.ACTION_TRIGGERED
Dispatched when the user or game controlling this avatar triggers an action.
An event type dispatched when an action is triggered. name - action name value - action value
See also
avatarSpoke | event |
com.whirled.ControlEvent
com.whirled.ControlEvent.AVATAR_SPOKE
Dispatched when the user controlling this avatar speaks. You may trigger a speak animation off of this event.
An event type dispatched when this avatar speaks. name - unused value - unused