Packagecom.worlize.api
Classpublic class WorlizeAPI
InheritanceWorlizeAPI Inheritance flash.events.EventDispatcher

Product Version : Worlize APIv.1

The entry point into the Worlize API functionality.

The WorlizeAPI class must be initialized before your app will become active and visible to users. If your app does not call the static WorlizeAPI.init() function within 30 seconds of your SWF's constructor executing, your app will be terminated.

Once the API is initialized, you can get a reference to the singleton instance by calling the static WorlizeAPI.getInstance() method. The instance is also returned when you call WorlizeAPI.init().



Public Properties
 PropertyDefined By
  authorMode : Boolean
[read-only] True if the current user has enabled author mode.
WorlizeAPI
  config : ConfigData
[read-only] Stores this app instance's persistent configuration data.
WorlizeAPI
  editMode : Boolean
[read-only] True if the edit mode is active within author mode.
WorlizeAPI
  options : APIOptions
[static] The APIOptions instance that defines the app's API settings.
WorlizeAPI
  stateHistory : StateHistory
[read-only] Use the StateHistory object to synchronize state across all connected users in the room.
WorlizeAPI
  syncedDataStore : SyncedDataStore
[read-only] Use the SyncedDataStore object to synchronize key/value pairs across all connected users in the room.
WorlizeAPI
  thisObject : ThisRoomObject
[read-only] An object representing the current object (app).
WorlizeAPI
  thisRoom : ThisRoom
[read-only] An object representing the current room.
WorlizeAPI
  thisUser : ThisUser
[read-only] An object representing the current user.
WorlizeAPI
  thisWorld : World
[read-only] An object describing the current world.
WorlizeAPI
Public Methods
 MethodDefined By
  
WorlizeAPI(rootObject:DisplayObject, loaderInfo:LoaderInfo = null)
Constructor.
WorlizeAPI
  
[static] Returns a reference to the WorlizeAPI singleton instance.
WorlizeAPI
  
init(rootObject:DisplayObject, loaderInfo:LoaderInfo = null):WorlizeAPI
[static] Initializes the Worlize API; Must be called before the API is available for use.
WorlizeAPI
  
log(text:String):void
Write arbitrary text into the chat log.
WorlizeAPI
Events
 Event Summary Defined By
  Dispatched after author mode has been disabled by the user.WorlizeAPI
  Dispatched after author mode mode has been enabled by the user.WorlizeAPI
  Dispatched after the app's edit mode has been disabled by the user.WorlizeAPI
  Dispatched after the app's edit mode has been enabled by the user.WorlizeAPI
  Dispatched when the user releases the mouse button anywhere on the screen.WorlizeAPI
Public Constants
 ConstantDefined By
  VERSION : int = 2
[static] A constant indicating the version of the Worlize API.
WorlizeAPI
Property Detail
authorModeproperty
authorMode:Boolean  [read-only]

Product Version : Worlize APIv.1

True if the current user has enabled author mode.

Only users with the canAuthor privilege will be able to author the room, and this property can only be true when the app is running on a computer where the user has access to author mode.


Implementation
    public function get authorMode():Boolean
configproperty 
config:ConfigData  [read-only]

Product Version : Worlize APIv.1

Stores this app instance's persistent configuration data.


Implementation
    public function get config():ConfigData

See also

editModeproperty 
editMode:Boolean  [read-only]

Product Version : Worlize APIv.1

True if the edit mode is active within author mode.

This becomes active when the user selects the "Edit Settings..." option from the Object Properties dialog for this object within author mode.

Can only be true if the current user has the canAuthor privilege and the editModeSupported API option is true.


Implementation
    public function get editMode():Boolean

See also

optionsproperty 
public static var options:APIOptions

Product Version : Worlize APIv.1

The APIOptions instance that defines the app's API settings.

stateHistoryproperty 
stateHistory:StateHistory  [read-only]

Product Version : Worlize APIv.1

Use the StateHistory object to synchronize state across all connected users in the room.


Implementation
    public function get stateHistory():StateHistory

See also

syncedDataStoreproperty 
syncedDataStore:SyncedDataStore  [read-only]

Product Version : Worlize APIv.1

Use the SyncedDataStore object to synchronize key/value pairs across all connected users in the room.


Implementation
    public function get syncedDataStore():SyncedDataStore

See also

thisObjectproperty 
thisObject:ThisRoomObject  [read-only]

Product Version : Worlize APIv.1

An object representing the current object (app).

Use this object to control aspects of this app's execution, such as its size and position, and to listen for broadcast messages from this or other apps.


Implementation
    public function get thisObject():ThisRoomObject

See also

com.worlize.api.model.ThisObject.messageReceived
com.worlize.api.model.ThisObject.setSize()
com.worlize.api.model.ThisObject.moveTo()
thisRoomproperty 
thisRoom:ThisRoom  [read-only]

Product Version : Worlize APIv.1

An object representing the current room.

This is the entry point to much of the API functionality, since the ThisRoom instance provides access to the list of users in the room, other objects (apps) in the room, etc.. It also dispatches crucial events, such as incomingChat, outgoingChat, and userMoved.


Implementation
    public function get thisRoom():ThisRoom
thisUserproperty 
thisUser:ThisUser  [read-only]

Product Version : Worlize APIv.1

An object representing the current user.

Use this object to control the user's avatar, move the user on screen, cause the user to say things, etc.


Implementation
    public function get thisUser():ThisUser

See also

thisWorldproperty 
thisWorld:World  [read-only]

An object describing the current world.


Implementation
    public function get thisWorld():World
Constructor Detail
WorlizeAPI()Constructor
public function WorlizeAPI(rootObject:DisplayObject, loaderInfo:LoaderInfo = null)

Product Version : Worlize APIv.1

Constructor.

You may not instantiate the WorlizeAPI class directly. WorlizeAPI is a Singleton class, and as such, you must gain access to its singleton instance by calling getInstance(), which will construct the instance internally if necessary.

Parameters
rootObject:DisplayObject
 
loaderInfo:LoaderInfo (default = null)

Throws
Error — if you try to instantiate more than one copy of WorlizeAPI

See also

Method Detail
getInstance()method
public static function getInstance():WorlizeAPI

Product Version : Worlize APIv.1

Returns a reference to the WorlizeAPI singleton instance.

Use this throughout your app to gain access to the Worlize API functionality.

Returns
WorlizeAPI — the WorlizeAPI singleton instance

Throws
Error — if the API has not yet been initialized.

See also

init()method 
public static function init(rootObject:DisplayObject, loaderInfo:LoaderInfo = null):WorlizeAPI

Initializes the Worlize API; Must be called before the API is available for use.

Call this as soon as possible in your app's lifecycle, preferably in your constructor function. This method will create the WorlizeAPI singleton instance and set up communications with the main Worlize application across the sandbox bridge.

When calling init you must pass your root DisplayObject as the rootObject parameter.

NOTE: If you are building a Flex app, your top- level application class does not contain a handy reference to the SWF's LoaderInfo instance, and you must pass it separately as the loaderInfo parameter. If you are building a standard Flash application and have easy access to the true top-level DisplayObject instance, just omit the loaderInfo parameter.

Parameters

rootObject:DisplayObject — the top level DisplayObject for your application.
 
loaderInfo:LoaderInfo (default = null) — (optional) the main LoaderInfo instance for your application, if not available from the provided rootObject.

Returns
WorlizeAPI — the WorlizeAPI singleton instance

See also

log()method 
public function log(text:String):void

Product Version : Worlize APIv.1

Write arbitrary text into the chat log.

Parameters

text:String — the text to log

See also

Event Detail
authorModeDisabled Event
Event Object Type: com.worlize.api.event.AuthorEvent
AuthorEvent.type property = com.worlize.api.event.AuthorEvent.AUTHOR_MODE_DISABLED

Product Version : Worlize API.v1

Dispatched after author mode has been disabled by the user.

The AuthorEvent.AUTHOR_MODE_DISABLED constant defines the value of the type property of the event object for a authorModeDisabled event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
authorModeEnabled Event  
Event Object Type: com.worlize.api.event.AuthorEvent
AuthorEvent.type property = com.worlize.api.event.AuthorEvent.AUTHOR_MODE_ENABLED

Product Version : Worlize API.v1

Dispatched after author mode mode has been enabled by the user.

The AuthorEvent.AUTHOR_MODE_ENABLED constant defines the value of the type property of the event object for a authorModeEnabled event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
editModeDisabled Event  
Event Object Type: com.worlize.api.event.AuthorEvent
AuthorEvent.type property = com.worlize.api.event.AuthorEvent.EDIT_MODE_DISABLED

Product Version : Worlize API.v1

Dispatched after the app's edit mode has been disabled by the user.

The AuthorEvent.EDIT_MODE_DISABLED constant defines the value of the type property of the event object for a editModeDisabled event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
editModeEnabled Event  
Event Object Type: com.worlize.api.event.AuthorEvent
AuthorEvent.type property = com.worlize.api.event.AuthorEvent.EDIT_MODE_ENABLED

Product Version : Worlize API.v1

Dispatched after the app's edit mode has been enabled by the user.

The AuthorEvent.EDIT_MODE_ENABLED constant defines the value of the type property of the event object for a editModeEnabled event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
mouseUp Event  
Event Object Type: flash.events.MouseEvent
MouseEvent.type property = flash.events.MouseEvent

Product Version : Worlize API.v1

Dispatched when the user releases the mouse button anywhere on the screen.

Since embedded apps don't have access to the screen area outside the boundaries of their own rectangle, listen to this event to track mouseUp events that occur outside the app's boundaries.

Traditionally, ActionScript 3 components like a Button would listen for a mouseUp event on the stage. However, since embedded apps are sandboxed and attempting to listen to mouse events on the stage will throw a SecurityError, the Worlize API provides this equivalent event proxied through the sandbox boundaries.

Constant Detail
VERSIONConstant
public static const VERSION:int = 2

Product Version : Worlize APIv.1

A constant indicating the version of the Worlize API. The Worlize API version is an integer, which means that there is no major or minor revision number. It increments by one every time there is a released change to the API.