Server-Side Communication ActionScript > Application (object)

 

Application (object)

The Application object contains information about a Flash Communication Server application instance that lasts until the application instance is unloaded. A Flash Communication Server application is a collection of stream objects, shared objects, and clients (connected users). Each application has a unique name, and you can use the naming scheme described in Using naming conventions to create multiple instances of an application.

The Application object lets you accept and reject client connection attempts, register and unregister classes and proxies, and create functions that are invoked when an application starts or stops or when a client connects or disconnects.

Besides the built-in properties of the Application object, you can create other properties of any legal ActionScript type, including references to other ActionScript objects. For example, the following lines of code create a new property of type array and a new property of type number:

application.myarray = new Array();
application.num_requests = 1;

 
Method summary for the Application object

Method

Description

Application.acceptConnection

Accepts a connection to an application from a client.

Application.clearSharedObjects

Clears all shared objects associated with the current instance.

Application.clearStreams

Clears all stream objects associated with the current instance.

Application.disconnect

Disconnects a client from the server.

Application.getStats

Returns network statistics for the application instance.

Application.registerClass

Registers or unregisters a constructor that is called during object deserialization.

Application.registerProxy

Registers a NetConnection or Client object to fulfill a method request.

Application.rejectConnection

Rejects a connection to an application.


 
Property summary for the Application object

Property (read-only)

Description

Application.clients

An object containing a list of all clients currently connected to the application.

Application.hostname

The hostname of the server for default virtual hosts, and virtual hostname for non-default virtual hosts.

Application.name

The name of an application instance.

Application.server

The platform and version of the server.


 
Event handler summary for the Application object

Event handler

Description

Application.onAppStart

Invoked when the application is loaded by the server.

Application.onAppStop

Invoked when the application is unloaded by the server.

Application.onConnect

Invoked when a client connects to the application.

Application.onConnectAccept

Invoked when a client successfully connects to the application; for use with communication components only.

Application.onConnectReject

Invoked when a client fails to connect to the application; for use with communication components only.

Application.onDisconnect

Invoked when a client disconnects from the application.

Application.onStatus

Invoked when a script generates an error.