package de.maxmaurer.FlashGameCommunicator.Events { import flash.events.Event; /** * FlashGameCommunicator - 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:

* */ public class GameEvent extends Event { /** Fired when connection was established */ public static var CONNECTED:String="flashGameCommunicatorConnected"; /** Fired when connection was disconnected */ public static var DISCONNECTED:String="flashGameCommunicatorDisconnected"; /** Fired when a message is incoming from the server */ public static var MESSAGE:String="flashGameCommunicatorMessage"; /** Fired when a command sent to the server succeeded */ public static var SUCCESS:String="flashGameCommunicatorSuccess"; /** Fired when a command failed */ public static var FAILED:String="flashGameCommunicatorFailed"; /** Fired when a user has been thrown out of the current room*/ public static var KICKED:String="flashGameCommunicatorKicked"; /** 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. */ public var messageType:uint; /** Contains the users ID after a connection attempt (ACTION_CONNECTING)*/ public var myId:Number; /** Contains the room-id after an ACTION_ROOM_CREATE or an ACTION_ROOM_JOIN */ public var roomId:Number; /** Contains the room-name after an ACTION_ROOM_CREATE, an ACTION_ROOM_JOIN or an ACTION_ROOM_INFORMATION*/ public var roomName:String; /** Contains the maximum room capacity after a ACTION_ROOM_INFORMATION */ public var roomCapacity:Number; /** Contains wether the room is locked or not after an ACTION_ROOM_INFORMATION */ public var roomLocked:Boolean; /** Contains the room size (how many people are already in there) after an ACTION_ROOM_INFORMATION */ public var roomSize:Number; /** Contains the message that has been send after any of the MESSAGE_... eventTypes. */ public var message:String; /** Contains the id of the sender (or 0 for the server itself) after any of the MESSAGE_... eventTypes. */ public var senderId:Number; /** Contains the name of the sender (or something like "Server") after any of the MESSAGE_... eventTypes. */ public var senderName:String; /** 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.size(). *

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. *

*/ public var dataArray:Array; /** * The GameEvent constructor should never be called externally */ function GameEvent(type:String,params:Object):void { super(type,false,false); myId=params.myId; messageType = params.messageType; roomId = params.roomId; roomName = params.roomName; dataArray = params.dataArray; roomCapacity = params.roomCapacity; roomSize = params.roomSize; roomLocked = params.roomLocked; senderName = params.senderName; senderId = params.senderId; message = params.message; } } }