onAppExit This page was last modified over 30 day(s) ago and has 1 comment(s)


Back to Application Class Summary

Availability
Windows, Mac OSX, Linux

Usage
mdm.Application.onAppExit:Function

Parameters
None

Returns
None

Description
Dispatched when the user attempts to exit the application.
This function will only execute when the exit handler has been enabled with Application.enableExitHandler().

Notes
There are two ways to listen for events in 4.0:
#1
using "onEventNameFunction" - callback based handlers introduced in {mdm} 2.0
#2
using IEventListener model based on Events introduced in 4.0.

No matter what implementation you would use either callback and listener handler would have to use single-argument defintion as in below sample:
// callback based handlers
mdm.Appllication.onAppChangeFocus = function(event:Event):void
{
// proceed with event
};

// handlers based on IEventListener model
function onAppChangeFocusHandler(event:Event):void
{
// proceed with event
};

Example Code
mdm.Application.enableExitHandler();
//
function onAppExitHandler(event:Event):void
{
// your code invoked on application exit
mdm.Application.exit();
};
//
mdm.Application.addEventListener("onAppExit", onAppExitHandler);


// or
mdm.Application.onAppExit = function(event:Event):void
{
mdm.Application.exit();
};

mdm.Application Class Example Downloads
No Example Downloads Available


User Comment by ToddBFisher on 28th March 2012 - 15:22
Side note when upgrading to Zinc 4.0:
In Zinc 3.0 there was no "Event" argument passed to the mdm.Application.onAppExit handler. If your app is crashing upon trying to exit, the missing "Event" parameter may be the cause.

Registered Users must be logged in to 'MyAccount' to add a Comment - Log In Here
  After Logging In, Click Here to Refresh This Page