Package | de.maxmaurer.FlashGameCommunicator.Events |
Class | public class GameEvent |
Inheritance | GameEvent ![]() |
This class contains the Event fired every time an Eventchange happens within the FlashGameCommunicator.
Each event carries a different number of parameters which are listed below, which of these parameters contain values depends on the Event-Type as well as the messageType
An event listener can be bound to six different types of Events that may happen:
CONNECTED
The connected-event is fired when the connection to the
FlashGameCommunicator-Server has been established.DISCONNECTED
The disconnected-event is fired when the connection
to the server is ended or when the connection is lost by unknown reasonMESSAGE
Message events are the only events that happend without
a prior call to the FlashGameCommunicator-API. Every time a message intended for
this client is sent by the server the Message-Event fires. The type of the message
(BROADCAST, ROOM, PERSONAL or LOBBY) is stored in the messageType-field.SUCCESS
Success event describe a successfull execution of the
last command that was sent to the server. Return parameters of this command
may be read from this event object.FAILED
If an action could not be completed successfull this is
indicated by a failed-Event.KICKED
Kicked event appear when the master user of a room leaves
his rooms. The room is then removed and all players that where bound to that room
are kicked and thrown back to the lobby. This does NOT mean that the client has been
disconnected. But he's not anymore bound to any room and has to join again.Property | Defined by | ||
---|---|---|---|
CONNECTED : String = "flashGameCommunicatorConnected" [static] Fired when connection was established
| GameEvent | ||
dataArray : Array The dataArray contains a list of values after any server command that issues a list.
| GameEvent | ||
DISCONNECTED : String = "flashGameCommunicatorDisconnected" [static] Fired when connection was disconnected
| GameEvent | ||
FAILED : String = "flashGameCommunicatorFailed" [static] Fired when a command failed
| GameEvent | ||
KICKED : String = "flashGameCommunicatorKicked" [static] Fired when a user has been thrown out of the current room
| GameEvent | ||
message : String Contains the message that has been send after any of the
MESSAGE_... eventTypes. | GameEvent | ||
MESSAGE : String = "flashGameCommunicatorMessage" [static] Fired when a message is incoming from the server
| GameEvent | ||
messageType : uint Contains the messageType of this Event that may be either one of the
ACTION_...
| GameEvent | ||
myId : Number Contains the users ID after a connection attempt (
ACTION_CONNECTING ) | GameEvent | ||
roomCapacity : Number Contains the maximum room capacity after a
ACTION_ROOM_INFORMATION | GameEvent | ||
roomId : Number Contains the room-id after an
ACTION_ROOM_CREATE or an ACTION_ROOM_JOIN | GameEvent | ||
roomLocked : Boolean Contains wether the room is locked or not after an
ACTION_ROOM_INFORMATION | GameEvent | ||
roomName : String Contains the room-name after an
ACTION_ROOM_CREATE , an ACTION_ROOM_JOIN or an ACTION_ROOM_INFORMATION | GameEvent | ||
roomSize : Number Contains the room size (how many people are already in there) after an
ACTION_ROOM_INFORMATION | GameEvent | ||
senderId : Number Contains the id of the sender (or 0 for the server itself) after any of the
MESSAGE_... eventTypes. | GameEvent | ||
senderName : String Contains the name of the sender (or something like "Server") after any of the
MESSAGE_... eventTypes. | GameEvent | ||
SUCCESS : String = "flashGameCommunicatorSuccess" [static] Fired when a command sent to the server succeeded
| GameEvent | ||
userId : Number Contains the Id of a user when he has joined (
INFO_USER_JOINED ) or left(INFO_USER_LEFT ) the room. | GameEvent | ||
USER_JOINED : String = "flashGameCommunicatorUserJoined" [static] Fired when a user joined the room this user is currently in
| GameEvent | ||
USER_LEFT : String = "flashGameCommunicatorUserLeft" [static] Fired when a user left the room this user is currently in
| GameEvent | ||
userName : String Contains the Name of a user when he has joined (
INFO_USER_JOINED ) or left(INFO_USER_LEFT ) the room. | GameEvent |
Method | Defined by | ||
---|---|---|---|
GameEvent(type:String, params:Object)
The GameEvent constructor should never be called externally
| GameEvent |
CONNECTED | property |
public static var CONNECTED:String = "flashGameCommunicatorConnected"
Fired when connection was established
dataArray | property |
public var dataArray:Array
The dataArray contains a list of values after any server command that issues a list.
The number of values returned by the server can be retrieved via dataArray.length
.
In case of an ACTION_ROOM_LIST
the array contains elements with the roomId and
the roomName that can be retrieved via dataArray[0].roomId
or dataArray[0].roomName
.
In case of an ACTION_USER_LIST
or an ACTION_USER_LIST_ROOM
the
dataArray contains userId and userName of each user that can be access by dataArray[0].userId
and dataArray[0].userName
.
DISCONNECTED | property |
public static var DISCONNECTED:String = "flashGameCommunicatorDisconnected"
Fired when connection was disconnected
FAILED | property |
public static var FAILED:String = "flashGameCommunicatorFailed"
Fired when a command failed
KICKED | property |
public static var KICKED:String = "flashGameCommunicatorKicked"
Fired when a user has been thrown out of the current room
message | property |
public var message:String
Contains the message that has been send after any of the MESSAGE_...
eventTypes.
MESSAGE | property |
public static var MESSAGE:String = "flashGameCommunicatorMessage"
Fired when a message is incoming from the server
messageType | property |
public var messageType:uint
Contains the messageType of this Event that may be either one of the ACTION_... values of the FlashGameCommunicator class, when a server command was issued or one of the MESSAGE_... values of the FlashGameCommunicator class when a Incoming-Message event has been fired.
myId | property |
public var myId:Number
Contains the users ID after a connection attempt (ACTION_CONNECTING
)
roomCapacity | property |
public var roomCapacity:Number
Contains the maximum room capacity after a ACTION_ROOM_INFORMATION
roomId | property |
public var roomId:Number
Contains the room-id after an ACTION_ROOM_CREATE
or an ACTION_ROOM_JOIN
roomLocked | property |
public var roomLocked:Boolean
Contains wether the room is locked or not after an ACTION_ROOM_INFORMATION
roomName | property |
public var roomName:String
Contains the room-name after an ACTION_ROOM_CREATE
, an ACTION_ROOM_JOIN
or an ACTION_ROOM_INFORMATION
roomSize | property |
public var roomSize:Number
Contains the room size (how many people are already in there) after an ACTION_ROOM_INFORMATION
senderId | property |
public var senderId:Number
Contains the id of the sender (or 0 for the server itself) after any of the MESSAGE_...
eventTypes.
senderName | property |
public var senderName:String
Contains the name of the sender (or something like "Server") after any of the MESSAGE_...
eventTypes.
SUCCESS | property |
public static var SUCCESS:String = "flashGameCommunicatorSuccess"
Fired when a command sent to the server succeeded
userId | property |
public var userId:Number
Contains the Id of a user when he has joined (INFO_USER_JOINED
) or left(INFO_USER_LEFT
) the room.
USER_JOINED | property |
public static var USER_JOINED:String = "flashGameCommunicatorUserJoined"
Fired when a user joined the room this user is currently in
USER_LEFT | property |
public static var USER_LEFT:String = "flashGameCommunicatorUserLeft"
Fired when a user left the room this user is currently in
userName | property |
public var userName:String
Contains the Name of a user when he has joined (INFO_USER_JOINED
) or left(INFO_USER_LEFT
) the room.
GameEvent | () | constructor |
public function GameEvent(type:String, params:Object)
The GameEvent constructor should never be called externally
Parameterstype:String |
|
params:Object |