|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Object | +--Multiplayer
This is the core object of the multiplayer interface. Typically, this interface is used by constructing a new object, registering a listener to hear when the login is complete, and calling the login() function.
A typical instance might look like this:
var multiplayer = new Multiplayer();
multiplayer.addEventListener("login", onLogin, false);
multiplayer.login("myusername", "GameName");
function onLogin(event)
{
//do something
}
onEnterFrame(). In Javascript code, it can be called from setInterval() or setTimeout(). | Field Summary | |
Game |
game
This object holds the status of the current game. |
String |
username
The username seen by the server and other users. |
| Constructor Summary | |
Multiplayer
()
Create a new multiplayer session. |
|
| Method Summary | |
void
|
addEventListener(<String> type, <Function> handler, <boolean> capture)
Registers an event listener for a given event. |
void
|
checkMessages()
This function must be called on a regular basis for messages to be processed. |
void
|
dispatchEvent(<Event> event)
Fires an event off to all registered listeners. |
boolean
|
isWii()
Used to detect if we are running on the Nintendo Wii or not. |
void
|
login(<String> username, <String> gamename)
This object will not establish a connection to the server until this function is called. |
void
|
removeEventListener(<String> type, <Function> handler, <boolean> capture)
Removes a previously registered event handler. |
String
|
toString()
Returns "[Object Multiplayer]" to help distinguish the type of the object. |
| Field Detail |
Game game
String username
| Constructor Detail |
Multiplayer()
| Method Detail |
void addEventListener(<String> type, <Function> handler, <boolean> capture)
login - Login success or failure.transfer - Fired when the player is moved to a different room.gamestart - The game in the current Stadium has started.gamereset - The game in the current Stadium has ended.messagearrive - The server has sent a message to this client.disconnect - Client has been disconnected from the server.type - The name of the event to listen for.
handler - The function to call when the event is fired.
capture - Reserved. Always pass false for this parameter.
void checkMessages()
onEnterFrame() loop. In Javascript programs, it can be
called from a function registered with setInterval()
or setTimeout().
void dispatchEvent(<Event> event)
event -
boolean isWii()
void login(<String> username, <String> gamename)
username - The username you wish to use.
gamename - The game to connect to.
void removeEventListener(<String> type, <Function> handler, <boolean> capture)
type - The name of the event listened for.
handler - The function to call when the event is fired.
capture - Reserved. Always pass false for this paramter.
String toString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||