Packagecom.multiuserserver.client
Classpublic class MultiuserServerClient
InheritanceMultiuserServerClient Inheritance flash.events.EventDispatcher

Mesmotronic Multiuser Server Client

Availability: 2.0.0



Public Properties
 PropertyDefined 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
Public Methods
 MethodDefined 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
Events
 EventSummaryDefined 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
Property detail
connectedproperty
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
delegateproperty 
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
infoproperty 
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

Constructor detail
MultiuserServerClient()constructor
public function MultiuserServerClient()

Mesmotronic Multiuser Server Client

Used to connect to Mesmotronic Multiuser Server.

Availability: 2.0.0


Example
var myClient:MultiuserServerClient = new MultiuserServerClient();

Method detail
call()method
public function 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.

Availability: 2.0.0

Parameters
method: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).

Returns
Boolean — boolean A boolean value representing whether the call was made, returns false if you are not connected to the server.

Example
myClient.call("myMethod", [100, 200], "onMyMethod");

close()method 
public function close():void

Closes the current connection to Mesmotronic Multiuser Server.

Availability: 2.0.0


Example
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):void

Connect 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

Parameters
ip: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


Example
myClient.connect("127.0.0.1", 54321, "MyApplication", 5);

run()method 
public function run(method:String, argArray:Array = null, ... clientIndices):Boolean

Run a function on one or more clients in the current room.

Availability: 2.0.0

Parameters
method: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).

Returns
Boolean — boolean A boolean value representing whether the run request was made (returns false if you are not connected to the server).

See also


Example
myClient.run("myMethod", [100, 200]);

Event detail
clientConnectevent 
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched when a client joins the room.

Availability: 2.0.0

clientDisconnectevent  
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched when a client leaves the room.

Availability: 2.0.0

closeevent  
Event object type: flash.events.Event

Dispatched when the connection to Mesmotronic Multiuser Server is closed.

Availability: 2.0.0

connectevent  
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched when you have successfully connected to Mesmotronic Multiuser Server.

Availability: 2.0.0

ioErrorevent  
Event object type: flash.events.IOErrorEvent

Dispatched when an IO error occurs.

Availability: 2.0.0

progressevent  
Event object type: flash.events.ProgressEvent

Dispatched as a communication between the client and Mesmotronic Multiuser Server progresses.

Availability: 2.0.0

rejectevent  
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched when your connection is rejected by the server.

Availability: 2.0.0

securityErrorevent  
Event object type: flash.events.SecurityErrorEvent

Dispatched when a security error occurs.

Availability: 2.0.0

terminateevent  
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched when your connection is terminated by the server-side application.

Availability: 2.0.0