| Package | com.smartfoxserver.v2.requests.buddylist |
| Class | public class BlockBuddyRequest |
| Inheritance | BlockBuddyRequest com.smartfoxserver.v2.requests.BaseRequest |
In order to block a buddy, the current user must be online in the Buddy List system. If the operation is successful, a buddyBlock confirmation event is dispatched; otherwise the buddyError event is fired.
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 | ||
|---|---|---|---|
BlockBuddyRequest(buddyName:String, blocked:Boolean)
Creates a new BlockBuddyRequest instance. | BlockBuddyRequest | ||
| BlockBuddyRequest | () | Constructor |
public function BlockBuddyRequest(buddyName:String, blocked:Boolean)Creates a new BlockBuddyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
ParametersbuddyName:String — The name of the buddy to be blocked or unblocked.
| |
blocked:Boolean — true if the buddy must be blocked; false if he must be unblocked.
|
See also
private function someMethod():void
{
sfs.addEventListener(SFSBuddyEvent.BUDDY_BLOCK, onBuddyBlock);
sfs.addEventListener(SFSBuddyEvent.BUDDY_ERROR, onBuddyError);
// Block Jack in my buddies list
sfs.send(new BlockBuddyRequest("Jack", true));
}
private function onBuddyBlock(evt:SFSBuddyEvent):void
{
var isBlocked:Boolean = evt.params.buddy.isBlocked;
trace("Buddy " + evt.params.buddy.name + " is now " + (isBlocked ? "blocked" : "unblocked"));
}
private function onBuddyError(evt:SFSBuddyEvent):void
{
trace("The following error occurred while executing a buddy-related request:", evt.params.errorMessage);
}