Packagecom.smartfoxserver.v2.requests.buddylist
Classpublic class InitBuddyListRequest
InheritanceInitBuddyListRequest Inheritance com.smartfoxserver.v2.requests.BaseRequest

Initializes the Buddy List system on the current client.

Buddy List system initialization involves loading any previously stored buddy-specific data from the server, such as the current user's buddies list, his previous state and the persistent Buddy Variables. The initialization request is the first operation to be executed in order to be able to use the Buddy List system features. Once the initialization is completed, the buddyListInit event is fired and the user has access to all his previously set data and can start to interact with his buddies; if the initialization failed, a buddyError event id fired.

View the examples

See also

buddyListInit event
buddyError event


Public Methods
 MethodDefined By
  
Creates a new InitBuddyListRequest instance.
InitBuddyListRequest
Constructor Detail
InitBuddyListRequest()Constructor
public function InitBuddyListRequest()

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

See also

Examples
The following example initializes the Buddy List system:
     
     private function someMethod():void
     {
         sfs.addEventListener(SFSBuddyEvent.BUDDY_LIST_INIT, onBuddyListInitialized);
         sfs.addEventListener(SFSBuddyEvent.BUDDY_ERROR, onBuddyError)
         
         // Initialize the Buddy List system
         sfs.send(new InitBuddyListRequest());
     }
     
     private function onBuddyListInitialized(evt:SFSBuddyEvent):void
     {
         trace("Buddy List system initialized successfully");
         
         // Retrieve my buddies list
         var buddies:Array = sfs.buddyManager.buddyList;
         
         // Display the online buddies in a list component in the application interface
         ...
     }
     
     private function onBuddyError(evt:SFSBuddyEvent):void
     {
         trace("The following error occurred while executing a buddy-related request:", evt.params.errorMessage);
     }