
18
SERVER-SIDE ACTIONSCRIPT LANGUAGE REFERENCE FOR ADOBE MEDIA SERVER 5.0.1
Server-Side ActionScript Language Reference
Last updated 7/2/2013
Parameters
info An Object, called an information object, with properties that explain why the application is about to stop
running. The information object has a
code property and a level property.
Returns
The value returned by the function you define, if any, or null. To unload the application, return true or any non-
false value. To refuse to unload the application, return false.
Example
The following example flushes the entries_so shared object when the application stops:
application.onAppStop = function (info){
trace("*** onAppStop called.");
if (info=="Application.Shutdown"){
application.entries_so.flush();
}
}
application.onConnect()
application.onConnect = function (clientObj [, p1, ..., pN]){}
Invoked when NetConnection.connect() is called from the client. This handler is passed a Client object
representing the connecting client. Use the Client object to perform actions on the client in the handler. For example,
use this function to accept, reject, or redirect a client connection, perform authentication, define methods on the Client
object to be called remotely from
NetConnection.call(), and set the Client.readAccess and
Client.writeAccess properties to determine client access rights to server-side objects.
When performing authentication, all of the information required for authentication should be sent from the
NetConnection.connect() method to the onConnect() handler as parameters (p1..., pN).
If you don’t define an onConnect() handler, connections are accepted by default.
If there are several simultaneous connection requests for an application, the server serializes the requests so that only
one
application.onConnect() handler is executed at a time. It’s a good idea to write code for the
application.onConnect() function that is executed quickly to prevent a long connection time for clients.
Note: When you are using the version 2 component framework (that is, when you are loading the components.asc file in
your server-side script file), you must use the
application.onConnectAccept() method to accept client connections.
Availability
Flash Communication Server 1
Parameters
clientObj A Client object. This object contains information about the client that is connecting to the application.
p1 ..., pN Optional parameters passed to the application.onConnect() handler from the client-side
NetConnection.connect() method when a client connects to the application.
Code property Level property Description
Application.Shutdown status The application instance is about to shut down.
Application.GC status The application instance is about to be destroyed by the server.
Komentarze do niniejszej Instrukcji