| Package | com.multiuserserver.client |
| Class | public class MultiuserServerClient |
| Inheritance | MultiuserServerClient flash.events.EventDispatcher |
Availability: 2.0.0
| Property | Defined by | ||
|---|---|---|---|
| connected : Boolean [read-only]
Indicates whether the client is connected to the server or not
Availability: 2.0.0 | MultiuserServerClient | ||
| delegate : *
Specifies the object on which callback methods (methods called remotely using call or run)
will be delegated to.
| MultiuserServerClient | ||
| info : MultiuserServerClientInfo
Client connection information.
| MultiuserServerClient | ||
| Method | Defined by | ||
|---|---|---|---|
|
Mesmotronic Multiuser Server Client
Used to connect to Mesmotronic Multiuser Server. Availability: 2.0.0 | MultiuserServerClient | ||
|
call(method:String, argArray:Array = null, returnMethod:String = null, ... clientIndices):Boolean
Call a method on the server application and, optionally, have the result returned to one or more clients in the current room.
| MultiuserServerClient | ||
|
close():void
Closes the current connection to Mesmotronic Multiuser Server.
| MultiuserServerClient | ||
|
connect(ip:String, port:int, application:String, clientsPerRoom:int, language:String = "default", roomToAvoid:int = -1, roomToUse:int = -1, connectData:* = null):void
Connect to Mesmotronic Multiuser Server 2.
| MultiuserServerClient | ||
|
run(method:String, argArray:Array = null, ... clientIndices):Boolean
Run a function on one or more clients in the current room.
| MultiuserServerClient | ||
| Event | Summary | Defined by | ||
|---|---|---|---|---|
| Dispatched when a client joins the room. | MultiuserServerClient | |||
| Dispatched when a client leaves the room. | MultiuserServerClient | |||
| Dispatched when the connection to Mesmotronic Multiuser Server is closed. | MultiuserServerClient | |||
| Dispatched when you have successfully connected to Mesmotronic Multiuser Server. | MultiuserServerClient | |||
| Dispatched when an IO error occurs. | MultiuserServerClient | |||
| Dispatched as a communication between the client and Mesmotronic Multiuser Server progresses. | MultiuserServerClient | |||
| Dispatched when your connection is rejected by the server. | MultiuserServerClient | |||
| Dispatched when a security error occurs. | MultiuserServerClient | |||
| Dispatched when your connection is terminated by the server-side application. | MultiuserServerClient | |||
| connected | property |
connected:Boolean [read-only]Indicates whether the client is connected to the server or not
Availability: 2.0.0
Implementation public function get connected():Boolean
| delegate | property |
delegate:* [read-write]Specifies the object on which callback methods (methods called remotely using call or run) will be delegated to. The delegate object can be any class or object except an instance of the MultiuserServerClient class.
Methods of the delegate object must be created in the format myMethod(clientIndex:int): or myMethod(clientIndex:int, data::(where data is expected). The clientIndex value indicates the client from which the call originated (-1 indicates that the call did not come from a client) and the asterisk symbols should be replaced with the appropriate data type.
The client-side delegate has no default value.
Availability: 2.0.0
This property can be used as the source for data binding.
Implementation public function get delegate():*
public function set delegate(value:*):void
| info | property |
info:MultiuserServerClientInfo [read-write]Client connection information.
When connected, the info property contains details of the current connection.
Setting the info property will close the current connection (if connected) and attempt to re-connect using the information provided; in this scenario, room and clientIndex properties will be ignored.
Availability: 2.0.0
This property can be used as the source for data binding.
Implementation public function get info():MultiuserServerClientInfo
public function set info(value:MultiuserServerClientInfo):void
See also
| MultiuserServerClient | () | constructor |
public function MultiuserServerClient()Mesmotronic Multiuser Server Client
Used to connect to Mesmotronic Multiuser Server.
Availability: 2.0.0
var myClient:MultiuserServerClient = new MultiuserServerClient();
| call | () | method |
public function call(method:String, argArray:Array = null, returnMethod:String = null, ... clientIndices):BooleanCall a method on the server application and, optionally, have the result returned to one or more clients in the current room.
Availability: 2.0.0
Parametersmethod:String — method Method to call (or event to dispatch) on the server-side application.
|
|
argArray:Array (default = null) — argArray Arguments to pass to the server-side method: most standard data types are supported, including Object, Array, String, Boolean, Number and ByteArray.
|
|
returnMethod:String (default = null) — returnMethod The name of the method to run if/when a result is returned (optional).
|
|
... clientIndices — clientIndices The clientIndex of 1 or more clients to return the result to (optional: defaults to sender).
|
Boolean — boolean A boolean value representing whether the call was made, returns false if you are not connected to the server.
|
myClient.call("myMethod", [100, 200], "onMyMethod");
| close | () | method |
public function close():voidCloses the current connection to Mesmotronic Multiuser Server.
Availability: 2.0.0
myClient.close();
| connect | () | method |
public function connect(ip:String, port:int, application:String, clientsPerRoom:int, language:String = "default", roomToAvoid:int = -1, roomToUse:int = -1, connectData:* = null):voidConnect to Mesmotronic Multiuser Server 2.
Only ip, port, application and clientsPerRoom are required; if both roomToUse and roomToAvoid are specified, roomToAvoid will be ignored.
Availability: 2.0.0
Parametersip:String — ip IP address or domain name of the server.
|
|
port:int — port The port to connect on.
|
|
application:String — application Unique application identifier; the server-side application of the same name will be run if it exists.
|
|
clientsPerRoom:int — clientsPerRoom Maximum number of clients per room.
|
|
language:String (default = "default") — language Language preference (optional: defaults to "default");
|
|
roomToAvoid:int (default = -1) — roomToAvoid Room to avoid: the client will NOT be allocated a space in the specified room, even if that room has an available space. Use -1 if you do not wish to avoid any rooms. (optional: defaults to allocation in the first available room, i.e. -1).
|
|
roomToUse:int (default = -1) — roomToUse Room to use: the server will try to allocate the client to the specifed room ONLY, and will fail if the room is already full. Use -1 if you do not wish to specify a room. (optional: defaults to allocation in the first available room, i.e. -1).
|
|
connectData:* (default = null) — connectData Client-specific data that will be passed to the MultiuserServerEvent.CLIENT_CONNECT event (optional).
|
See also
myClient.connect("127.0.0.1", 54321, "MyApplication", 5);
| run | () | method |
public function run(method:String, argArray:Array = null, ... clientIndices):BooleanRun a function on one or more clients in the current room.
Availability: 2.0.0
Parametersmethod:String — method Name of the method to run on one or more clients in the current room.
|
|
argArray:Array (default = null) — argArray Arguments to be passed to the method: most standard data types are supported, including Object, Array, String, Boolean, Number and ByteArray.
|
|
... clientIndices — clientIndices The clientIndex of 1 or more clients to return the result to (optional: defaults to all clients).
|
Boolean — boolean A boolean value representing whether the run request was made (returns false if you are not connected to the server).
|
See also
myClient.run("myMethod", [100, 200]);
| clientConnect | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when a client joins the room.
Availability: 2.0.0
| clientDisconnect | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when a client leaves the room.
Availability: 2.0.0
| close | event |
flash.events.Event
Dispatched when the connection to Mesmotronic Multiuser Server is closed.
Availability: 2.0.0
| connect | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when you have successfully connected to Mesmotronic Multiuser Server.
Availability: 2.0.0
| ioError | event |
flash.events.IOErrorEvent
Dispatched when an IO error occurs.
Availability: 2.0.0
| progress | event |
flash.events.ProgressEvent
Dispatched as a communication between the client and Mesmotronic Multiuser Server progresses.
Availability: 2.0.0
| reject | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when your connection is rejected by the server.
Availability: 2.0.0
| securityError | event |
flash.events.SecurityErrorEvent
Dispatched when a security error occurs.
Availability: 2.0.0
| terminate | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when your connection is terminated by the server-side application.
Availability: 2.0.0