Packagecom.myflashlab.air.extensions.googleGames
Classpublic class RealTime
InheritanceRealTime Inheritance flash.events.EventDispatcher

A client to interact with real time multiplayer functionality.



Public Properties
 PropertyDefined By
  showWaitingRoomAutomatically : Boolean
[write-only] Indicates if the ANE should automatically open the waiting room UI.
RealTime
Public Methods
 MethodDefined By
  
createRoom($minAutoMatchPlayers:int = -1, $maxAutoMatchPlayers:int = -1, $exclusiveBitMask:int = 0, $variant:int = -1, $addPlayersToInvite:Array = null):void
Create a real-time room for the current game.
RealTime
  
declineInvitation($invitationId:String):void
Decline an invitation for a real-time room.
RealTime
  
dismissInvitation($invitationId:String):void
Dismiss an invitation to a real-time room.
RealTime
  
RealTime
  
joinRoom($invitationIdToAccept:String):void
joins a real-time room by accepting an invitation.
RealTime
  
leave($room:Room):void
leaves the specified room.
RealTime
  
sendReliableMessage($data:String, $roomId:String, $recipientParticipantId:String, $callback:Function):void
Asynchronously starts the message send operation to a participant in a real-time room reliably.
RealTime
  
sendUnreliableMessage($data:String, $roomId:String, $recipientParticipantIds:Array, $callback:Function):void
Asynchronously starts the message send operation to a participant in a real-time room.
RealTime
  
showNativeWindowInvitePlayers($minPlayers:int, $maxPlayers:int, $exclusiveBitMask:int = 0, $variant:int = -1):void
loads a native window that will let the user select opponents to send an invitation to for a real-time multiplayer match.
RealTime
Public Constants
 ConstantDefined By
  MAX_RELIABLE_MESSAGE_LEN : int = 1400
[static]
RealTime
  MAX_UNRELIABLE_MESSAGE_LEN : int = 1168
[static]
RealTime
Property Detail
showWaitingRoomAutomaticallyproperty
showWaitingRoomAutomatically:Boolean  [write-only]

Indicates if the ANE should automatically open the waiting room UI. Default value is true.


Implementation
    public function set showWaitingRoomAutomatically(value:Boolean):void
Method Detail
createRoom()method
public function createRoom($minAutoMatchPlayers:int = -1, $maxAutoMatchPlayers:int = -1, $exclusiveBitMask:int = 0, $variant:int = -1, $addPlayersToInvite:Array = null):void

Create a real-time room for the current game. The room created by this API is a resource that needs to be released by the leave(); method when the caller is done with it.

Parameters

$minAutoMatchPlayers:int (default = -1) — Minimum number of auto-matched players.
 
$maxAutoMatchPlayers:int (default = -1) — Maximum number of auto-matched players.
 
$exclusiveBitMask:int (default = 0) — Exclusive bitmasks for the automatching request. The logical AND of each pairing of automatching requests must equal zero for auto-match. If there are no exclusivity requirements for the game, this value should just be set to 0.
 
$variant:int (default = -1) — This is an optional, developer-controlled parameter describing the type of game to play, and is used for auto-matching criteria. Must be either a positive integer or -1 (the default) if not desired.
 
$addPlayersToInvite:Array (default = null) — Add a list of player IDs to invite to the room.

declineInvitation()method 
public function declineInvitation($invitationId:String):void

Decline an invitation for a real-time room.

Parameters

$invitationId:String — The ID of the invitation to decline.

dismissInvitation()method 
public function dismissInvitation($invitationId:String):void

Dismiss an invitation to a real-time room. Dismissing an invitation will not change the state of the room for the other participants.

Parameters

$invitationId:String — The ID of the invitation to dismiss.

dismissNativeWaitingRoom()method 
public function dismissNativeWaitingRoom():void

joinRoom()method 
public function joinRoom($invitationIdToAccept:String):void

joins a real-time room by accepting an invitation. The result is delivered by the REAL_TIME_ROOM_JOINED event.

Parameters

$invitationIdToAccept:String

leave()method 
public function leave($room:Room):void

leaves the specified room. This will disconnect the player from the room, but allow other players to continue playing the game. The result is delivered by the REAL_TIME_ROOM_LEFT

Parameters

$room:Room

sendReliableMessage()method 
public function sendReliableMessage($data:String, $roomId:String, $recipientParticipantId:String, $callback:Function):void

Asynchronously starts the message send operation to a participant in a real-time room reliably. A successful Task will return the message token generated for the pending message via the callback function, and the caller will receive a MESSAGE_SENT dispatch to report the status of the send message operation.

Parameters

$data:String — The message to be sent. Should be at most MAX_RELIABLE_MESSAGE_LEN bytes.
 
$roomId:String — ID of the room for which the message is being sent.
 
$recipientParticipantId:String — The participant ID to send the message to.
 
$callback:Function — Expects two params. token as int and err as Error

sendUnreliableMessage()method 
public function sendUnreliableMessage($data:String, $roomId:String, $recipientParticipantIds:Array, $callback:Function):void

Asynchronously starts the message send operation to a participant in a real-time room. The message delivery is not reliable and will not report status after completion. The message is not sent if the Task is failed.

Parameters

$data:String — The message to be sent. Should be at most MAX_UNRELIABLE_MESSAGE_LEN bytes.
 
$roomId:String — ID of the room for which the message is being sent.
 
$recipientParticipantIds:Array — The participant IDs to send the message to.
 
$callback:Function — Expects one param. err as Error

showNativeWindowInvitePlayers()method 
public function showNativeWindowInvitePlayers($minPlayers:int, $maxPlayers:int, $exclusiveBitMask:int = 0, $variant:int = -1):void

loads a native window that will let the user select opponents to send an invitation to for a real-time multiplayer match.

Parameters

$minPlayers:int — The minimum number of players to select (not including the current player).
 
$maxPlayers:int — The maximum number of players to select (not including the current player).
 
$exclusiveBitMask:int (default = 0) — Exclusive bitmasks for the automatching request. The logical AND of each pairing of automatching requests must equal zero for auto-match. If there are no exclusivity requirements for the game, this value should just be set to 0.
 
$variant:int (default = -1) — This is an optional, developer-controlled parameter describing the type of game to play, and is used for auto-matching criteria. Must be either a positive integer or -1 (the default) if not desired.

Constant Detail
MAX_RELIABLE_MESSAGE_LENConstant
public static const MAX_RELIABLE_MESSAGE_LEN:int = 1400

MAX_UNRELIABLE_MESSAGE_LENConstant 
public static const MAX_UNRELIABLE_MESSAGE_LEN:int = 1168