Application Object

The Application object operates under the application instance. Variables, functions, and objects defined within this object are available to every client that connects to a specific instance. Application objects within other instances are not accessible.

Application Methods

The application methods are described in the following sections.

application.acceptConnection(clientObj)

Accepts incoming connection requests from Communication clients. Clients cannot access resources until this method is run.

ClientObj is the client URI requesting access.

application.clearSharedObjects(soPath);

Deletes persistent and temporary SharedObjects from the instance it was called from.

soPath The SharedObject name and path (myPath/myObject).

application.clearStreams(streamPath);

Removes all publish and subscription streams from all clients and servers within the instance it was called from.

streamPath The Stream object name and path (myPath/myStream).

application.disconnect(clientObj)

Disconnects the client from the application instance.

clientObj The name of the active client (Macromedia Flash player) to disconnect.

application.registerClass(className, constructor)

Allows a constructor to be registered or unregistered within the application instance. This is called during deserialization.

className The name of the Class to be registered or unregistered.
constructor The object's constructor function. This function must be the same name as the class name.

application.registerProxy(methodName, proxyConnection [, proxyMethodName])

Redirects a method request to a NetConnection or a client method proxy.

methodName The method to be redirected.
proxyConnection The Client or NetConnection object that contains the proxied method. Use a NULL value to unregister.
proxyMethodName An alternate method name within the proxied object.

application.rejectConnection(clientObj, errObj)

Rejects incoming connection requests from Communication clients. Clients cannot access any instance resources.

ClientObj The client URI requesting access.
errObj Used to send an object to the client's onStatus handler.

Application Properties

application.clients returns an object containing a list of all clients connected to the application instance.

application.name returns the current application instance name.

application.server returns the current server version and platform.

Application Events

application.onAppStart is invoked by an application instance, which is loaded by a client request or the App Inspector.

application.onAppStop is invoked when the application is shut down or unloaded from the server.

application.onConnect is invoked by a client's NetConnection.connect request. This method is used to handle the acceptConnection method.

application.onDisconnect is invoked by a client's NetConnection.close method, or if the client's connection is broken or the Flash movie is shut down or reloaded.

application.onStatus is invoked internally when a method or server-side ActionScript (SSAS) produces an error.



    Part I: 10 Quick Steps for Getting Started