Programmatically close an AIR application

I would like to know the correct way to close an AIR application programmatically.

In my Spark WindowedApplication, I have:

this.addEventListener( Event.CLOSING, shutdownApp );

and, of course, the implementation of the shutdownApp method (which basically organizes temporary files).

This is great for the close button to the right of the window. However, I also have functionality that requires shutting down the application. In the code I called:

NativeApplication.nativeApplication.exit();

However, this does not call the Event.CLOSING method, so my temporary files are not cleared. Shouldn't I call nativeApplication.exit? If so, what should I name? I would prefer not to call my shutdownApp method before NativeApplication.exit (), as it does not look so elegant.

Can someone shed some light on the right way to do this?

Thank,

Phil

+5
3

, , . close exit WindowedApplication?

- , FlexGlobals topLevelApplication:

(FlexGlobals.topLevelApplication as WindowedApplication).close();

(FlexGlobals.topLevelApplication as WindowedApplication).exit();
+4

, , , , .

stage.nativeWindow.close();
+7

, sth.

- AIR, (spark.components.Window), , sparked WindowedApplication ( ) - ( . , , , , false).

. ActionScript,

      this.addEventListener(Event.Closing, windowClosed);

: . - s: Window MXML. :

      closing="window1_closingHandler(event)"

The event was then dispatched to window1_closingHandler-function, which I called

      NativeApplication.nativeApplication.exit();

This works for me and closes the whole application.

+1
source

All Articles