Packagecom.smartfoxserver.v2.entities.managers
Classpublic class SFSUserManager
InheritanceSFSUserManager Inheritance Object
Implements IUserManager

The SFSUserManager class is the entity in charge of managing the local (client-side) users list. It keeps track of all the users that are currently joined in the same Rooms of the current user. It also provides utility methods to look for users by name and id.

See also

SmartFox.userManager


Public Properties
 PropertyDefined By
  userCount : int
[read-only] Returns the total number of users in the local users list.
SFSUserManager
Public Methods
 MethodDefined By
  
Creates a new SFSUserManager instance.
SFSUserManager
  
containsUser(user:User):Boolean
Indicates whether a user exists in the local users list or not.
SFSUserManager
  
containsUserId(userId:int):Boolean
Indicates whether a user exists in the local users list or not from the id.
SFSUserManager
  
containsUserName(userName:String):Boolean
Indicates whether a user exists in the local users list or not from the name.
SFSUserManager
  
getUserById(userId:int):User
Retrieves a User object from its id property.
SFSUserManager
  
getUserByName(userName:String):User
Retrieves a User object from its name property.
SFSUserManager
  
getUserList():Array
Get the whole list of users inside the Rooms joined by the client.
SFSUserManager
Property Detail
userCountproperty
userCount:int  [read-only]

Returns the total number of users in the local users list.


Implementation
    public function get userCount():int
Constructor Detail
SFSUserManager()Constructor
public function SFSUserManager(sfs:SmartFox)

Creates a new SFSUserManager instance.

NOTE: developers never instantiate a SFSUserManager manually: this is done by the SmartFoxServer 2X API internally. A reference to the existing instance can be retrieved using the SmartFox.userManager property.

Parameters
sfs:SmartFox — An instance of the SmartFoxServer 2X client API main SmartFox class.

See also

Method Detail
clearAll()method
kernel function clearAll():void

containsUser()method 
public function containsUser(user:User):Boolean

Indicates whether a user exists in the local users list or not.

Parameters

user:User — The User object representing the user whose presence in the users list is to be tested.

Returns
Booleantrue if the passed user exists in the users list.
containsUserId()method 
public function containsUserId(userId:int):Boolean

Indicates whether a user exists in the local users list or not from the id.

Parameters

userId:int — The id of the user whose presence in the users list is to be tested.

Returns
Booleantrue if the passed user exists in the users list.
containsUserName()method 
public function containsUserName(userName:String):Boolean

Indicates whether a user exists in the local users list or not from the name.

Parameters

userName:String — The name of the user whose presence in the users list is to be tested.

Returns
Booleantrue if the passed user exists in the users list.
getUserById()method 
public function getUserById(userId:int):User

Retrieves a User object from its id property.

Parameters

userId:int — The id of the user to be found.

Returns
User — The User object representing the user, or null if no user with the passed id exists in the local users list.
getUserByName()method 
public function getUserByName(userName:String):User

Retrieves a User object from its name property.

Parameters

userName:String — The name of the user to be found.

Returns
User — The User object representing the user, or null if no user with the passed name exists in the local users list.
getUserList()method 
public function getUserList():Array

Get the whole list of users inside the Rooms joined by the client.

Returns
Array — The list of User objects representing the users in the local users list.