lobby.addEventListener
Prototype
public function addEventListener(eventName, callbackFunction)
Input parameters
eventName - name of the event to listen for
callbackFunction - name of the function to call when the event is triggered
Return value
null
Description
All communication with the server happens through the lobby component. Whenever a data packet is received, or any other network action occurs a corresponding event is triggered. These events can be handled using event listeners. The events you can receive from the lobby are: "EnterGame", "LeaveGame", "GameState", "AddPlayer", "RemovePlayer", "GotPacket", "GotSettings" and Event.CLOSE.
Please refer to the Programmers Guide for detailed descriptions of all events used by the lobby component.
Example code
lobby.addEventListener("AddPlayer", addPlayer);
...
function addPlayer(e:Object)
{
var playerInfo = e.dataobject;
// Handle a player that joins the game
// ...
}
