Package | com.smartfoxserver.v2.requests.buddylist |
Class | public class GoOnlineRequest |
Inheritance | GoOnlineRequest com.smartfoxserver.v2.requests.BaseRequest |
All clients who have the current user as buddy in their buddies list will receive the buddyOnlineStateChange event and see the Buddy.isOnline property change accordingly. The same event is also dispatched to the current user, who sent the request, so that the application interface can be updated accordingly. Going online/offline as buddy doesn't affect the user connection, the currently joined Zone and Rooms, etc.
The online state of a user in a buddy list is handled by means of a reserved and persistent Buddy Variable.
NOTE: this request can be sent if the Buddy List system was previously initialized only (see the InitBuddyListRequest request description).
See also
Method | Defined By | ||
---|---|---|---|
GoOnlineRequest(online:Boolean)
Creates a new GoOnlineRequest instance. | GoOnlineRequest |
GoOnlineRequest | () | Constructor |
public function GoOnlineRequest(online:Boolean)
Creates a new GoOnlineRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
Parametersonline:Boolean — true to make the current user available (online) in the Buddy List system; false to make him not available (offline).
|
See also
private function someMethod():void { sfs.addEventListener(SFSBuddyEvent.BUDDY_ONLINE_STATE_UPDATE, onBuddyOnlineStateUpdated); // Put myself offline in the Buddy List system sfs.send(new GoOnlineRequest(false)); } private function onBuddyOnlineStateUpdated(evt:SFSBuddyEvent):void { // As the state change event is dispatched to me too, // I have to check if I am the one who changed his state var isItMe:Boolean = evt.params.isItMe; if (isItMe) trace("I'm now", (sfs.buddyManager.myOnlineState ? "online" : "offline")); else trace("My buddy " + evt.params.buddy.name + " is now", (evt.params.buddy.isOnline ? "online" : "offline")); }