Server-Side Communication ActionScript > Application.onAppStop

 

Application.onAppStop

Availability

Flash Communication Server MX.

Usage

application.onAppStop = function (info){
	// insert code here
};

Parameters

info An information object that explains why the application stopped running. See Server-Side Information Objects.Returns

The value returned by the function you define, if any, or null. To refuse to unload the application, return false. To unload the application, return true or any non-false value.

Description

Event handler; invoked when the application is about to be unloaded by the server. You can define a function that executes when the event handler is invoked. If the function returns true, the application unloads. If the function returns false, the application doesn't unload. If you don't define a function for this event handler, or if the return value is not a Boolean value, the application is unloaded when the event is invoked.

The Flash Communication Server application passes an information object to the application.onAppStop event. You can use server-side ActionScript to look at this information object to decide what to do in the function you define. You could also define the application.onAppStop event to notify users before shutdown.

If you use the Administration Console or the Server Management ActionScript API to unload a Flash Communication Server application, application.onAppStop is not invoked. Therefore you cannot use the application.onAppStop event, for example, to tell users that the application is exiting.

Example

This example defines a function to perform the shutdown operations on the application. The function is then assigned to the event handler so that it executes when the handler is invoked.

function onMyApplicationEnd(info){
	// Do all the application-specific shutdown logic...
	// insert code here
}

application.onAppStop = onMyApplicationEnd;