PlayerIO

The fastest way to build online games without breaking a sweat.

ActionScript3 Reference

actionscript 3 Multiplayer class informationClass Multiplayer

Namespace: playerio
Language: ActionScript 3

Provides access to the Multiplayer services provided by Player.IO.

Properties

 
public
developmentServer :String

If defined the system will connect to a local development server instead of a live server.

Methods

 
public
createJoinRoom (roomId:String, roomType:String, visible:Boolean, roomData:Object, joinData:Object, callback:Function = null, errorHandler:Function = null):void

Creates or joins a room of the specified server type.

public
createRoom (roomId:String, roomType:String, visible:Boolean, roomData:Object, callback:Function = null, errorHandler:Function = null):void

Creates a room of the specified server type.

public
joinRoom (roomId:String, joinData:Object, callback:Function = null, errorHandler:Function = null):void

Joins an already existing room

public
listRooms (roomType:String, searchCriteria:Object, resultLimit:int, resultOffset:int, callback:Function = null, errorHandler:Function = null):void

List all room instances of a specific server type

Multiplayer.developmentServer

public
developmentServer :String

If defined the system will connect to a local development server instead of a live server.

Example

The following example connects to a development server running on localhost on port 8184

Multiplayer.createJoinRoom

public
createJoinRoom (roomId:String, roomType:String, visible:Boolean, roomData:Object, joinData:Object, callback:Function = null, errorHandler:Function = null):void

Creates or joins a room of the specified server type.

Arguments

roomId:String
The id of the room, if set to null the room is assigned a random id
roomType:String
The type of room we should start
visible:Boolean
If the room should be returned when doing a listRooms request
roomData:Object
Init data, this init data can be read on by server: {Name:"MyRoom", Level:3}
joinData:Object
User join data, this join data can be read by the server: {Name:"Chris", Type:"Sniper"}
callback:Function (Default = null)
Method executed when the createJoinRoom call executed successfully: function(connection:Connection):void{...}
errorHandler:Function (Default = null)
Method executed if the createJoinRoom request failed: function(error:PlayerIOError):void{...}

Multiplayer.createRoom

public
createRoom (roomId:String, roomType:String, visible:Boolean, roomData:Object, callback:Function = null, errorHandler:Function = null):void

Creates a room of the specified server type.

Arguments

roomId:String
The id of the room, if set to null the room is assigned a random id
roomType:String
The type of room we should start
visible:Boolean
If the room should be returned when doing a listRooms request
roomData:Object
Init data, this init data can be read by server: {Name:"MyRoom", Level:3}
callback:Function (Default = null)
Method executed when the createRoom call executed successfully, returns the id of the created room: function(roomId:String):void{...}
errorHandler:Function (Default = null)
Method executed if the joinRoom request failed: function(error:PlayerIOError):void{...}

Multiplayer.joinRoom

public
joinRoom (roomId:String, joinData:Object, callback:Function = null, errorHandler:Function = null):void

Joins an already existing room

Arguments

roomId:String
The id of the room we wish to join
joinData:Object
User join data, this join data can be read by the server: {Name:"Chris", Type:"Sniper"}
callback:Function (Default = null)
Method executed when the joinRoom call executed successfully: function(connection:Connection):void{...}
errorHandler:Function (Default = null)
Method executed if the joinRoom request failed: function(error:PlayerIOError):void{...}

Multiplayer.listRooms

public
listRooms (roomType:String, searchCriteria:Object, resultLimit:int, resultOffset:int, callback:Function = null, errorHandler:Function = null):void

List all room instances of a specific server type

Arguments

roomType:String
The type of room we should list
searchCriteria:Object
Compares the properties of the parsed object to properties on the roomData object and returns only perfect matches. Passing the object {level:"3"} returns only rooms which have level defined as 3 on the roomData object. To use search criteria you must first define what properties are searchable under the Multiplayer menu option for your game.
resultLimit:int
How many room instances should we load from the server
resultOffset:int
At what offset should we list from
callback:Function (Default = null)
Method executed when the listRooms call executed successfully: function(rooms:Array<RoomInfo>):void{...}
errorHandler:Function (Default = null)
Method executed if the listRooms request failed: function(error:PlayerIOError):void{...}