Packagecom.worlize.api.model
Classpublic class ThisUser
InheritanceThisUser Inheritance User Inheritance flash.events.EventDispatcher

Product Version : Worlize APIv.1

Represents the current user ("this" user).

The current user is the user whose machine is currently executing the app code.

This class adds additional functionality to the User class to allow the app to manipulate and control the user's avatar.

Note that this class makes writable certain read-only properties of its User superclass:

See also

com.worlize.api.model.ThisRoom
com.worlize.api.model.User


Public Properties
 PropertyDefined By
 Inheritedavatar : Avatar
[read-only] The user's current avatar
User
  balloonColor : int
The background color index of the user's chat baloons.
ThisUser
 InheritedcanAuthor : Boolean
[read-only] True if the user has permission to author the current room.
User
  color : int
The color index of the user's default "gummy" avatar.
ThisUser
 Inheritedguid : String
[read-only] The user's Globally Unique Identifier
User
 Inheritedname : String
[read-only] The user's username.
User
 Inheritedprivileges : Array
[read-only] A list of strings representing the user's current permissions.
User
 Inheritedx : int
[read-only] The horizontal position of the user's avatar in the room's coordinate space.
User
 Inheritedy : int
[read-only] The vertical position of the user's avatar in the room's coordinate space.
User
Public Methods
 MethodDefined By
  
gotoRoom(roomGuid:String):void
Cause the user to go to another room, specified by GUID.
ThisUser
  
moveTo(x:int, y:int):void
Move the user's avatar, relative to the room's coordinate space.
ThisUser
  
Removes the user's avatar, resetting back to the default "gummy" avatar.
ThisUser
  
say(text:String, whisperTo:User = null):void
Make the user say or whisper the given chat text.
ThisUser
  
setAvatar(avatarOrGuid:Object):void
Changes the user's avatar.
ThisUser
Events
 Event Summary Defined By
 InheritedDispatched after the user's avatar has changed.User
 InheritedDispatched after the user's text baloon background color has changed.User
 InheritedDispatched after the color of the user's default "gummy" avatar has changed.User
 InheritedDispatched after the user's avatar has moved.User
 InheritedDispatched after the user's privileges have changedUser
Property Detail
balloonColorproperty
balloonColor:int

The background color index of the user's chat baloons.

Valid values range from 0 to 15, inclusive

The current colors are as follows, but subject to change:

IndexColor
0#FF9999 - Red
1#FF9966 - Orange
2#FFCC88 - Gold
3#FFEE99 - Yellow
4#D0F29F - Yellow-Green
5#B9F29F - Green
6#AFF2AE - Green 2
7#C4F4DE - Green-Cyan
8#A9EEF1 - Cyan
9#8DD2FF - Cyan-Blue
10#86ABFF - Blue
11#8F86FF - Blue-Violet
12#AB86FF - Violet
13#EF86FF - Magenta
14#FF86E4 - Magenta-Rose
15#FF86B1 - Rose


Implementation
    public function get balloonColor():int
    public function set balloonColor(value:int):void
colorproperty 
color:int

The color index of the user's default "gummy" avatar.

Valid values range from 0 to 12, inclusive


Implementation
    public function get color():int
    public function set color(value:int):void
Method Detail
gotoRoom()method
public function gotoRoom(roomGuid:String):void

Product Version : Worlize APIv.1

Cause the user to go to another room, specified by GUID.

Parameters

roomGuid:String — the GUID of the destination room

moveTo()method 
public function moveTo(x:int, y:int):void

Product Version : Worlize APIv.1

Move the user's avatar, relative to the room's coordinate space.

Parameters

x:int — horizontal position in pixels, in the room's coordinate space
 
y:int — vertical position in pixels, in the room's coordinate space

removeAvatar()method 
public function removeAvatar():void

Product Version : Worlize APIv.1

Removes the user's avatar, resetting back to the default "gummy" avatar.

Equivalent to setAvatar(null)

say()method 
public function say(text:String, whisperTo:User = null):void

Product Version : Worlize APIv.1

Make the user say or whisper the given chat text.

Optionally specify a User instance as the second argument to make it a private message (whisper).

Parameters

text:String — the chat text to say
 
whisperTo:User (default = null) — (optional) the User to whisper to

setAvatar()method 
public function setAvatar(avatarOrGuid:Object):void

Product Version : Worlize APIv.1

Changes the user's avatar.

Set to null to remove any avatar and revert back to the default "gummy" avatar.

Note that apps are not permitted to activate the user's webcam as their avatar.

Parameters

avatarOrGuid:Object — an Avatar instance or the desired avatar's String GUID


Example
Change the user's avatar
         
         // Get a reference to this user
         var thisUser:ThisUser = WorlizeAPI.getInstance().thisUser;
         
         // Change the user's avatar into a round, blue happyface.
         thisUser.setAvatar('97d7cb1d-86ee-2106-844d-099bf59c501c');
         
         // Alternate method:
         var happyFaceAvatar:Avatar = new Avatar();
         happyFaceAvatar.guid = '97d7cb1d-86ee-2106-844d-099bf59c501c';
         thisUser.setAvatar(happyFaceAvatar);