| Package | com.multiuserserver.server |
| Interface | public interface IApplication extends flash.events.IEventDispatcher |
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
| Property | Defined 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 | ||
| Method | Defined 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 | ||
|
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 | ||
| Event | Summary | Defined 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 | |||
| activeApplications | property |
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
| applications | property |
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
| clients | property |
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
| clientsInRoom | property |
clientsInRoom:uint [read-only]How many clients are currently in the room
Availability: 2.0.0
Implementation public function get clientsInRoom():uint
| delegate | property |
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
| ip | property |
ip:String [read-only]The server's IP address
Availability: 2.0.0
Implementation public function get ip():String
| keepAlive | property |
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.
public function get keepAlive():Boolean
public function set keepAlive(value:Boolean):void
| language | property |
language:String [read-only]The language of the current room
Availability: 2.0.0
Implementation public function get language():String
| languages | property |
languages:Array [read-only]Array of languages in use by the current application.
Availability: 2.0.0
Implementation public function get languages():Array
| name | property |
name:String [read-only]The name of the current application
Availability: 2.0.0
Implementation public function get name():String
| path | property |
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
| port | property |
port:uint [read-only]The port over which the server is running
Availability: 2.0.0
Implementation public function get port():uint
| room | property |
room:uint [read-only]The ID of the current room
Availability: 2.0.0
Implementation public function get room():uint
| 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
Parametersmethod: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)
|
application.call("myMethod", {}, "onMyMethod");
application.call("myMethod", {}, "onMyMethod", 0, 3, 4);
| clearDebug | () | method |
public function clearDebug():voidClear all of the messages in the debug console's trace window.
Availability: 2.0.0
application.clearDebug();
| debug | () | method |
public function debug(message:*):voidSend a message to be displayed on the debug console's trace window.
Availability: 2.0.0
Parametersmessage:* — The message to send to the debug console's trace window as a String.
|
application.debug("Hello?");
| getApplications | () | method |
public function getApplications(application:String = null, language:String = null, includeEmptyRooms:Boolean = true):ArrayGet 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
Parametersapplication: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)
|
Array — Array of server-side application objects as IApplication interfaces
|
| getClient | () | method |
public function getClient(clientIndex:uint):IClientGet a Client reference from the clients Array which conforms to the IClient interface.
Availability: 2.0.0
ParametersclientIndex:uint |
IClient —
Client reference object
|
See also
| loadBinary | () | method |
public function loadBinary(path:String):ByteArrayLoads a binary data file from the local filesystem and return it as a ByteArray.
Availability: 2.0.0
Parameterspath:String |
ByteArray |
| loadText | () | method |
public function loadText(path:String):StringLoads a text file from the local filesystem and return it as a String.
Availability: 2.0.0
Parameterspath:String |
String |
| quit | () | method |
public function quit():BooleanClose all of the client connections and quit the current application instance (closing the room).
Availability: 2.0.0
ReturnsBoolean — Boolean (false) if the application could not be closed.
|
application.quit();
| saveBinary | () | method |
public function saveBinary(path:String, bytes:ByteArray):BooleanSave a binary file on the local filesystem, for example image data.
Availability: 2.0.0
Parameterspath:String |
|
bytes:ByteArray — Binary data to save in ByteArray format
|
Boolean — Boolean value of true if the file was saved, false if it was not
|
| saveDebug | () | method |
public function saveDebug(clear:Boolean = true):voidSave 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
Parametersclear:Boolean (default = true) — Boolean value, indicates whether the debug console should be cleared after it is saved (optional).
|
application.saveDebug();
| saveText | () | method |
public function saveText(path:String, text:String):BooleanSave String data as a text file on the local filesystem.
Availability: 2.0.0
Parameterspath:String |
|
text:String |
Boolean — Boolean value of true if the file was saved, false if it was not
|
| appStop | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched immediately before the application stops
Availability: 2.0.0
| clientConnect | event |
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
| clientDisconnect | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when a client disconnects from the application
Availability: 2.0.0
| clientPreconnect | event |
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
| status | event |
com.multiuserserver.events.MultiuserServerEvent
Dispatched when an error occurs
Availability: 2.0.0