User

Description

The User class is used internally by the SmartFoxClient object to store the properties of each user.  Also, User objects are returned by different methods and events of the API.

Version

1.0.0

Status

Final

Author

The gotoAndPlay() Team

Copyright

© 2006-2007 gotoAndPlay()

http://www.gotoandplay.it

http://www.smartfoxserver.com

Summary
The User class is used internally by the SmartFoxClient object to store the properties of each user.
The default contructor.
Get the user id.
Get the user name.
Retrieve a User Variable.
Retrieve the list of all User Variables.
A boolean flag indicating if the user is a spectator in the current room.
A boolean flag indicating if the user is a Moderator in the current Zone.
Retrieve the player id of the user.

Functions

User

public function User(id: int,
name: String)

The default contructor.

Parameters

idthe user id.
namethe user name.

getId

public function getId():int

Get the user id.

Parameters

None.

Return

intthe user id.

See also

getName

getName

public function getName():String

Get the user name.

Parameters

None.

Return

Stringthe user name.

See also

getId

getVariable

public function getVariables():Array

Retrieve a User Variable.

Parameters

varNamethe name of the variable.

Return

Objectthe variable value.

See also

getVariables, SmartFoxClient.setUserVariables

getVariables

Retrieve the list of all User Variables.

Parameters

None.

Return

Arraya list of all User Variables.

See also

getVariable, SmartFoxClient.setUserVariables

isSpectator

public function isSpectator():Boolean

A boolean flag indicating if the user is a spectator in the current room.

Parameters

None.

Return

Booleantrue if the user is a spectator.

isModerator

public function isModerator():Boolean

A boolean flag indicating if the user is a Moderator in the current Zone.

You can get more details about Moderators in the “Zone configuration” documentation (http://www.smartfoxserver.com- /docs- /docPages- /config- /basics.htm#zone).

Parameters

None.

Return

Booleantrue if the user is a Moderator.

getPlayerId

public function getPlayerId():int

Retrieve the player id of the user.

The user must be a player inside a game room for this method to work properly.

This id is 1-based (player 1, player 2, etc.), but if the user is a spectator its value is -1.

Parameters

None.

Return

intthe current player id.
This is the class responsible for connecting to the server and handling all related events.
public function User(id: int,
name: String)
The default contructor.
public function getId():int
Get the user id.
public function getName():String
Get the user name.
public function getVariables():Array
Retrieve a User Variable.
public function isSpectator():Boolean
A boolean flag indicating if the user is a spectator in the current room.
public function isModerator():Boolean
A boolean flag indicating if the user is a Moderator in the current Zone.
public function getPlayerId():int
Retrieve the player id of the user.
Retrieve the list of all User Variables.
public function setUserVariables(varObj: Object,  
roomId: int = -1):void
Set on or more User Variables.