Packagecom.multiuserserver.server
Interfacepublic interface IApplication extends flash.events.IEventDispatcher

Mesmotronic Multiuser Server 2 Application Interface

This interface should not be used directly: it is the interface used by the application property of the MultiuserServerApplication class.

Availability: 2.0.0

See also

MultiuserServerApplication.html


Public Properties
 PropertyDefined by
  activeApplications : Array
[read-only] Array of IApplication interfaces, one for each active room of the current application using the same language setting; rooms which have been closed will not be returned and therefore the resulting Array may not be in room order.
IApplication
  applications : Array
[read-only] Array of IApplication interfaces, one for each room of the current application using the same language setting; the resulting array is in room order, with closed rooms returned as NULL.
IApplication
  clients : Array
[read-only] Array of IClient interfaces, allowing interaction with individual clients

Availability: 2.0.0

IApplication
  clientsInRoom : uint
[read-only] How many clients are currently in the room

Availability: 2.0.0

IApplication
  delegate : *
Specifies the object on which methods called remotely using 'call' will be delegated to.
IApplication
  ip : String
[read-only] The server's IP address

Availability: 2.0.0

IApplication
  keepAlive : Boolean
Whether or not to keep the room open after the last client has left.
IApplication
  language : String
[read-only] The language of the current room

Availability: 2.0.0

IApplication
  languages : Array
[read-only] Array of languages in use by the current application.
IApplication
  name : String
[read-only] The name of the current application

Availability: 2.0.0

IApplication
  path : String
[read-only] The absolute path of the folder in which the current application's SWF resides on the local filesystem, with a trailling backslash.
IApplication
  port : uint
[read-only] The port over which the server is running

Availability: 2.0.0

IApplication
  room : uint
[read-only] The ID of the current room

Availability: 2.0.0

IApplication
Public Methods
 MethodDefined by
  
call(method:String, argArray:Array = null, returnMethod:String = null, ... clientIndices):void

Call a client-side application method on all connected clients and have the result returned to the server-side application.

The client-side object(s) containing the method being called must be registered using the client-side addCallResponder() method.

The example below would call a method called myMethod on each of the clients, and the results would be returned to a function called onMyMethod.

Availability: 2.0.0

IApplication
  
clearDebug():void
Clear all of the messages in the debug console's trace window.
IApplication
  
debug(message:*):void
Send a message to be displayed on the debug console's trace window.
IApplication
  
getApplications(application:String = null, language:String = null, includeEmptyRooms:Boolean = true):Array
Get an Array of all of the server-side application objects for a specified application and language, giving you access to all of their methods and properties, including their clients Array; ideal for creating lobby applications.
IApplication
  
getClient(clientIndex:uint):IClient
Get a Client reference from the clients Array which conforms to the IClient interface.
IApplication
  
loadBinary(path:String):ByteArray
Loads a binary data file from the local filesystem and return it as a ByteArray.
IApplication
  
loadText(path:String):String
Loads a text file from the local filesystem and return it as a String.
IApplication
  
quit():Boolean
Close all of the client connections and quit the current application instance (closing the room).
IApplication
  
saveBinary(path:String, bytes:ByteArray):Boolean
Save a binary file on the local filesystem, for example image data.
IApplication
  
saveDebug(clear:Boolean = true):void
Save the content of the debug console's trace window and, optionally, clear it.
IApplication
  
saveText(path:String, text:String):Boolean
Save String data as a text file on the local filesystem.
IApplication
Events
 EventSummaryDefined by
   Dispatched immediately before the application stops

Availability: 2.0.0

IApplication
   Dispatched when a client connects to the application, after the MultiuserServerEvent.CONNECT event has been dispatched on the client, but before the client-side MultiuserServerEvent.CLIENT_CONNECT event is dispatched.IApplication
   Dispatched when a client disconnects from the application

Availability: 2.0.0

IApplication
   Dispatched when a client has been allocated to a room but before the MultiuserServerEvent.CONNECT and MultiuserServerEvent.USER_CONNECT events are dispatched on the client(s).IApplication
   Dispatched when an error occurs

Availability: 2.0.0

IApplication
Property detail
activeApplicationsproperty
activeApplications:Array  [read-only]

Array of IApplication interfaces, one for each active room of the current application using the same language setting; rooms which have been closed will not be returned and therefore the resulting Array may not be in room order.

Availability: 2.0.0

Implementation
    public function get activeApplications():Array
applicationsproperty 
applications:Array  [read-only]

Array of IApplication interfaces, one for each room of the current application using the same language setting; the resulting array is in room order, with closed rooms returned as NULL.

Availability: 2.0.0

Implementation
    public function get applications():Array
clientsproperty 
clients:Array  [read-only]

Array of IClient interfaces, allowing interaction with individual clients

Availability: 2.0.0

Implementation
    public function get clients():Array

See also

clientsInRoomproperty 
clientsInRoom:uint  [read-only]

How many clients are currently in the room

Availability: 2.0.0

Implementation
    public function get clientsInRoom():uint
delegateproperty 
delegate:*  [read-write]

Specifies the object on which methods called remotely using 'call' will be delegated to. The delegate object can be any class or object except an object derived from the IApplication interface.

The server-side delegate defaults to the current MultiuserServerApplication instance if no other value is specified.

Availability: 2.0.0

Implementation
    public function get delegate():*
    public function set delegate(value:*):void
ipproperty 
ip:String  [read-only]

The server's IP address

Availability: 2.0.0

Implementation
    public function get ip():String
keepAliveproperty 
keepAlive:Boolean  [read-write]

Whether or not to keep the room open after the last client has left.

Availability: 2.0.0

The default value is false.

Implementation
    public function get keepAlive():Boolean
    public function set keepAlive(value:Boolean):void
languageproperty 
language:String  [read-only]

The language of the current room

Availability: 2.0.0

Implementation
    public function get language():String
languagesproperty 
languages:Array  [read-only]

Array of languages in use by the current application.

Availability: 2.0.0

Implementation
    public function get languages():Array
nameproperty 
name:String  [read-only]

The name of the current application

Availability: 2.0.0

Implementation
    public function get name():String
pathproperty 
path:String  [read-only]

The absolute path of the folder in which the current application's SWF resides on the local filesystem, with a trailling backslash.

Availability: 2.0.0

Implementation
    public function get path():String
portproperty 
port:uint  [read-only]

The port over which the server is running

Availability: 2.0.0

Implementation
    public function get port():uint
roomproperty 
room:uint  [read-only]

The ID of the current room

Availability: 2.0.0

Implementation
    public function get room():uint
Method detail
call()method
public function call(method:String, argArray:Array = null, returnMethod:String = null, ... clientIndices):void

Call a client-side application method on all connected clients and have the result returned to the server-side application.

The client-side object(s) containing the method being called must be registered using the client-side addCallResponder() method.

The example below would call a method called myMethod on each of the clients, and the results would be returned to a function called onMyMethod.

Availability: 2.0.0

Parameters
method:String — method Method name to call on the server-side application.
 
argArray:Array (default = null) — argArray Arguments to pass to the client method: most standard data types are supported, including Object, Array, String, Boolean and Number. (optional)
 
returnMethod:String (default = null) — returnMethod Server method to return the result to. (optional)
 
... clientIndices — One or more client to call the method on (optional: defaults to all clients in current room)

Example
application.call("myMethod", {}, "onMyMethod");
application.call("myMethod", {}, "onMyMethod", 0, 3, 4);

clearDebug()method 
public function clearDebug():void

Clear all of the messages in the debug console's trace window.

Availability: 2.0.0


Example
application.clearDebug();

debug()method 
public function debug(message:*):void

Send a message to be displayed on the debug console's trace window.

Availability: 2.0.0

Parameters
message:* — The message to send to the debug console's trace window as a String.

Example
application.debug("Hello?");

getApplications()method 
public function getApplications(application:String = null, language:String = null, includeEmptyRooms:Boolean = true):Array

Get an Array of all of the server-side application objects for a specified application and language, giving you access to all of their methods and properties, including their clients Array; ideal for creating lobby applications.

If one or more parameters are not specified, the application and/or language parameters will default to the current application and/or language, i.e. if no parameters are specified, it is the same as using the applications property.

For a list of languages currently in use, use the languages property.

Availability: 2.0.0

Parameters
application:String (default = null) — The application name (optional)
 
language:String (default = null) — The language sub-division (optional)
 
includeEmptyRooms:Boolean (default = true) — Whether or not to return applications in room order, including empty rooms as null (default: true)

Returns
Array — Array of server-side application objects as IApplication interfaces
getClient()method 
public function getClient(clientIndex:uint):IClient

Get a Client reference from the clients Array which conforms to the IClient interface.

Availability: 2.0.0

Parameters
clientIndex:uint

Returns
IClient — Client reference object

See also

loadBinary()method 
public function loadBinary(path:String):ByteArray

Loads a binary data file from the local filesystem and return it as a ByteArray.

Availability: 2.0.0

Parameters
path:String

Returns
ByteArray
loadText()method 
public function loadText(path:String):String

Loads a text file from the local filesystem and return it as a String.

Availability: 2.0.0

Parameters
path:String

Returns
String
quit()method 
public function quit():Boolean

Close all of the client connections and quit the current application instance (closing the room).

Availability: 2.0.0

Returns
Boolean — Boolean (false) if the application could not be closed.

Example
application.quit();

saveBinary()method 
public function saveBinary(path:String, bytes:ByteArray):Boolean

Save a binary file on the local filesystem, for example image data.

Availability: 2.0.0

Parameters
path:String
 
bytes:ByteArray — Binary data to save in ByteArray format

Returns
Boolean — Boolean value of true if the file was saved, false if it was not
saveDebug()method 
public function saveDebug(clear:Boolean = true):void

Save the content of the debug console's trace window and, optionally, clear it.

Saved messages are stored in the applications debugger folder using the current date and time, in the format: YYYYMMDDHHMMSS.txt

Availability: 2.0.0

Parameters
clear:Boolean (default = true) — Boolean value, indicates whether the debug console should be cleared after it is saved (optional).

Example
application.saveDebug();

saveText()method 
public function saveText(path:String, text:String):Boolean

Save String data as a text file on the local filesystem.

Availability: 2.0.0

Parameters
path:String
 
text:String

Returns
Boolean — Boolean value of true if the file was saved, false if it was not
Event detail
appStopevent 
Event object type: com.multiuserserver.events.MultiuserServerEvent

Dispatched immediately before the application stops

Availability: 2.0.0

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

Dispatched when a client connects to the application, after the MultiuserServerEvent.CONNECT event has been dispatched on the client, but before the client-side MultiuserServerEvent.CLIENT_CONNECT event is dispatched.

Availability: 2.0.0

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

Dispatched when a client disconnects from the application

Availability: 2.0.0

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

Dispatched when a client has been allocated to a room but before the MultiuserServerEvent.CONNECT and MultiuserServerEvent.USER_CONNECT events are dispatched on the client(s).

You should not attempt any server-client communication at this stage of the connection process.

Availability: 2.0.0

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

Dispatched when an error occurs

Availability: 2.0.0