Packagecom.smartfoxserver.v2.requests
Classpublic class FindUsersRequest
InheritanceFindUsersRequest Inheritance com.smartfoxserver.v2.requests.BaseRequest

Retrieves a list of users from the server which match the specified criteria.

By providing a matching expression and a search scope (a Room, a Group or the entire Zone), SmartFoxServer can find those users matching the passed criteria and return them by means of the userFindResult event.

View the examples

See also

MatchExpression
userFindResult event


Public Methods
 MethodDefined By
  
FindUsersRequest(expr:MatchExpression, target:* = null, limit:int = 0)
Creates a new FindUsersRequest instance.
FindUsersRequest
Constructor Detail
FindUsersRequest()Constructor
public function FindUsersRequest(expr:MatchExpression, target:* = null, limit:int = 0)

Creates a new FindUsersRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.

Parameters
expr:MatchExpression — A matching expression that the system will use to retrieve the users.
 
target:* (default = null) — The name of a Group or a single Room object where to search for matching users; if null, the search is performed in the whole Zone.
 
limit:int (default = 0) — The maximum size of the list of users that will be returned by the userFindResult event. If 0, all the found users are returned.

See also

Examples
The following example looks for all the users whose "age" User Variable is greater than 29:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSEvent.USER_FIND_RESULT, onUserFindResult);
         
         // Create a matching expression to find users with an "age" variable greater than 29:
         var exp:MatchExpression = new MatchExpression("age", NumberMatch.GREATER_THAN, 29);
         
         // Find the users
         sfs.send(new FindUsersRequest(exp));
     }
     
     private function onUserFindResult(evt:SFSEvent):void
     {
         trace("Users found: " + evt.params.users);
     }