Package | com.smartfoxserver.v2.requests.buddylist |
Class | public class InitBuddyListRequest |
Inheritance | InitBuddyListRequest com.smartfoxserver.v2.requests.BaseRequest |
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.
See also
Method | Defined By | ||
---|---|---|---|
Creates a new InitBuddyListRequest instance. | InitBuddyListRequest |
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
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); }