Packagecom.whirled
Classpublic class ActorControl
InheritanceActorControl Inheritance EntityControl Inheritance AbstractControl Inheritance flash.events.EventDispatcher
SubclassesAvatarControl, PetControl

Defines actions, accessors and callbacks available to all in-world mobiles. An mobile is something that has an orientation in the scene and can request to change locations.



Protected Properties
 PropertyDefined by
 Inherited_env : String
The environment in which we're running.
EntityControl
Public Methods
 MethodDefined by
  
ActorControl(disp:DisplayObject)
Creates a controller for a mobile.
ActorControl
 Inherited
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
AbstractControl
 Inherited
canManageRoom(memberId:int = 0):Boolean
Returns true if the local client has management privileges in the current room.
EntityControl
 Inherited
clearPopup():void
Clear any showing popup.
EntityControl
 Inherited
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server together.
AbstractControl
 Inherited
getCamera(index:String = null):Camera
Access the local user's camera.
EntityControl
 Inherited
getDefaultDataPack():ByteArray
Get the default datapack for this entity, or null if there is none defined.
EntityControl
 Inherited
getEntityIds(type:String = null):Array
Enumerates the ids of all entities in this room.
EntityControl
 Inherited
getEntityProperty(key:String, entityId:String = null):Object
Looks up and returns the specified property for the specified entity.
EntityControl
 Inherited
getEnvironment():String
Get the "environment" in which this entity is presently running.
EntityControl
 Inherited
Get the id of the viewer that is viewing this instance.
EntityControl
 Inherited
Returns our current logical location in the scene.
EntityControl
 Inherited
getMemories():Object
Return an associative hash of all the memories.
EntityControl
 Inherited
getMemory(key:String, defval:Object = null):Object
Returns the value associated with the supplied key in this item's memory.
EntityControl
 Inherited
getMicrophone(index:int = -1):Microphone
Access the local user's microphone.
EntityControl
 Inherited
getMusicId3():Object
Get the id3 metadata of the currently playing music.
EntityControl
 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.
EntityControl
 Inherited
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
 Inherited
Returns our current location in the scene, in pixel coordinates.
EntityControl
 Inherited
getRoomBounds():Array
Get the room's bounds in pixels.
EntityControl
  
getState():String
Get the current state.
ActorControl
 Inherited
getViewerName(id:int = 0):String
Get the non-unique display name of the user viewing a particular instance.
EntityControl
 Inherited
hasControl():Boolean
Detects whether this client is in control.
EntityControl
 Inherited
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
 Inherited
registerCustomConfig(func:Function):void
Register a function used for generating a custom config panel.
EntityControl
 Inherited
registerPropertyProvider(func:Function):void
Registers a function that provides custom entity properties.
EntityControl
 Inherited
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
AbstractControl
 Inherited
sendMessage(name:String, arg:Object = null):void
Send a message to other instances of this entity, resulting in a MESSAGE_RECEIVED event.
EntityControl
 Inherited
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
 Inherited
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
 Inherited
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
  
setState(state:String):void
Set the state of this actor.
ActorControl
 Inherited
setTickInterval(interval:Number):void
Configures the interval on which this item is "ticked" in milliseconds.
EntityControl
 Inherited
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
 Inherited
triggerAction(name:String, arg:Object = null):void
Triggers an action on this scene object.
EntityControl
Events
 EventSummaryDefined by
 Inherited 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
 Inherited Dispatched to entities when they overhear chatter in the room.EntityControl
 Inherited Dispatched when this instance gains control.EntityControl
 Inherited Dispatched when an entity enters the room.EntityControl
 Inherited Dispatched when an entity leaves the room.EntityControl
 Inherited Dispatched when an entity in the room (other than the listening entity) changes location.EntityControl
 Inherited Dispatched when the instance in control updates the memory of this digital item.EntityControl
 Inherited Dispatched when any instance sends a message to all instances.EntityControl
 Inherited Dispatched when id3 data is found in the currently playing song.EntityControl
 Inherited Dispatched when music starts playing in the room.EntityControl
 Inherited Dispatched when music stops playing in the room.EntityControl
 Inherited 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
 Inherited Dispatched once per tick, only when this instance has control and only if tick interval is registered.EntityControl
 Inherited Event.UNLOAD Dispatched when the SWF using this control has been unloaded.AbstractControl
Public Constants
 ConstantDefined by
 InheritedENV_ROOM : String = "room"
[static] A constant returned by getEnvironment() to indicate that this entity is being viewed in a room.
EntityControl
 InheritedENV_SHOP : String = "shop"
[static] A constant returned by getEnvironment() to indicate that this entity is being viewed in the shop.
EntityControl
 InheritedENV_VIEWER : String = "viewer"
[static] A constant returned by getEnvironment() to indicate that this entity is being viewed in the "viewer": memories may be set and read, but they will not be saved.
EntityControl
 InheritedPROP_DIMENSIONS : String = "std:dimensions"
[static] The entity pixel dimensions (an Array [width, height]).
EntityControl
 InheritedPROP_HOTSPOT : String = "std:hotspot"
[static] The entity's hot spot (an Array [x, y]).
EntityControl
 InheritedPROP_LOCATION_LOGICAL : String = "std:location_logical"
[static] The entity's location in logical coordinates (an Array [ x, y, z ]).
EntityControl
 InheritedPROP_LOCATION_PIXEL : String = "std:location_pixel"
[static] The entity's location in pixel coordinates (an Array [ x, y, z ]).
EntityControl
 InheritedPROP_MEMBER_ID : String = "std:member_id"
[static] The unique Whirled player ID (int) of the wearer of the avatar, or the owner of the pet.
EntityControl
 InheritedPROP_MOVE_SPEED : String = "std:move_speed"
[static] The current movement speed of an actor (Number).
EntityControl
 InheritedPROP_NAME : String = "std:name"
[static] The non-unique display name of the entity (a String).
EntityControl
 InheritedPROP_ORIENTATION : String = "std:orientation"
[static] The entity facing direction (a Number).
EntityControl
 InheritedPROP_TYPE : String = "std:type"
[static] The type of the entity, TYPE_AVATAR, TYPE_PET or TYPE_FURNI.
EntityControl
 InheritedTYPE_AVATAR : String = "avatar"
[static] The type of avatar entities.
EntityControl
 InheritedTYPE_FURNI : String = "furni"
[static] The type of furniture entities.
EntityControl
 InheritedTYPE_PET : String = "pet"
[static] The type of pet entities.
EntityControl
Constructor detail
ActorControl()constructor
public function ActorControl(disp:DisplayObject)

Creates a controller for a mobile. The display object is the mobile's visualization.

Parameters
disp:DisplayObject
Method detail
getOrientation()method
public function getOrientation():Number

Returns the current orientation of this mobile.

Returns
Number — a value between 0 (facing straight ahead) moving counter-clockwise to 359.
getState()method 
public 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.

Returns
String
isMoving()method 
public function isMoving():Boolean

Returns whether the mobile is currently moving between locations in the scene.

Returns
Boolean
setLogicalLocation()method 
public function setLogicalLocation(x:Number, y:Number, z:Number, orient:Number):void

Requests that our location be updated. This will result in dispatch of the APPEARANCE_CHANGED event when the mobile starts moving and another when the mobile arrives at its destination and stops moving.

x, y, and z are Numbers between 0 and 1 indicating a percentage of the room's width, height and depth respectively. orient is a number between 0 (facing straight ahead) and 359, going counter-clockwise.

Parameters
x:Number
 
y:Number
 
z:Number
 
orient:Number

See also

setMoveSpeed()method 
public function setMoveSpeed(pixelsPerSecond:Number):void

Set this actor's movement speed, in pixels per second. The default value if unset is 500 pixels per second. The minimum possible speed currently is 50 pixels per second. This only sets the local move speed for this instance, and is not propogated out to other clients.

Parameters
pixelsPerSecond:Number
setOrientation()method 
public function setOrientation(orient:Number):void

Requests that our orientation be updated. This will result in a dispatch of the APPEARANCE_CHANGED event.

NOTE: this is currently not working.

Parameters
orient:Number — an orientation between 0 (facing straight ahead) and going to 359, counter-clockwise.

See also

setPixelLocation()method 
public function setPixelLocation(x:Number, y:Number, z:Number, orient:Number):void

Requests that our location be updated. x, y, and z are pixel values. orient is a number between 0 (facing straight ahead) and 359, going counter-clockwise.

Parameters
x:Number
 
y:Number
 
z:Number
 
orient:Number
setState()method 
public function setState(state:String):void

Set the state of this actor. An actor can only be in one state at a time, but it is persistent across rooms.

Note: only the instance "in control" may set states.

Parameters
state:String — A String identifier, which may be null, indicating the state. The maximum length is 64 characters.
Event detail
appearanceChangedevent 
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.ControlEvent.APPEARANCE_CHANGED

Dispatched as notification that the actor's appearance has changed. getOrientation() and isMoving() should be re-queried to paint the correct visual for the actor in its current state.

An event type dispatched when an Actor has had its appearance changed. Your code should react to this event and possibly redraw the actor, taking into account the orientation and whether the actor is moving or sleeping.
name - unused
value - unused

stateChangedevent  
Event object type: com.whirled.ControlEvent
ControlEvent.type property = com.whirled.ControlEvent.STATE_CHANGED

Dispatched as notification that the actor's state has changed.

An event type dispatched to actors to indicate that they should be in the specified state.
name - state name
value - unused