Package | com.smartfoxserver.v2.requests.game |
Class | public class InvitationReplyRequest |
Inheritance | InvitationReplyRequest com.smartfoxserver.v2.requests.BaseRequest |
Users who receive an invitation sent by means of the InviteUsersRequest request can either accept or refuse it using this request. The reply causes an invitationReply event to be dispatched to the inviter; if a reply is not sent, or it is sent after the invitation expiration, the system will react as if the invitation was refused.
If an error occurs while the reply is delivered to the inviter user (for example the invitation is already expired), an invitationReplyError event is returned to the current user.
See also
Method | Defined By | ||
---|---|---|---|
Creates a new InvitationReplyRequest instance. | InvitationReplyRequest |
InvitationReplyRequest | () | Constructor |
public function InvitationReplyRequest(invitation:Invitation, invitationReply:int, params:ISFSObject = null)
Creates a new InvitationReplyRequest instance. The instance must be passed to the SmartFox.send() method for the request to be performed.
Parametersinvitation:Invitation — An instance of the Invitation class containing the invitation details (inviter, custom parameters, etc).
| |
invitationReply:int — The answer to be sent to the inviter, among those available as constants in the InvitationReply class.
| |
params:ISFSObject (default = null ) — An instance of SFSObject containing custom parameters to be returned to the inviter together with the reply
(for example a message describing the reason of refusal).
|
See also
private function someMethod():void { sfs.addEventListener(SFSEvent.INVITATION, onInvitationReceived); sfs.addEventListener(SFSEvent.INVITATION_REPLY_ERROR, onInvitationReplyError); } private function onInvitationReceived(evt:SFSEvent):void { // Let's accept this invitation sfs.send(new InvitationReplyRequest(evt.params.invitation, InvitationReply.ACCEPT)); } private function onInvitationReplyError(evt:SFSEvent):void { trace("Failed to reply to invitation due to the following problem: " + evt.params.errorMessage); }