0 Replies Latest reply on Aug 11, 2009 5:59 PM by webedgegav

    Handling Mac Close events

    webedgegav Level 1

      I'm having an issue handling the various close event when running my application on a Mac. (all fine on Windows)


      When loading the page I execute this statement:


      window.nativeWindow.addEventListener(air.Event.CLOSING, MainWindow_OnClosing);


      The code to handle this event is as follows:


      var MainWindow_OnClosing = function(event){
              window.nativeWindow.visible = false;


      I need this handler so that the application returns to the Doc when hitting the standard Chrome close button.


      The problem I have is that this event also fires when a user hits the Command-Q comment (and also when the user shuts down the mac). This prevent the application from closing which is not what I want to do. The only way to close the application seems to be the ForceQuit command.


      Does anyone know of a way to distinguish between the close event from the Chrome close button and the close event from the Command-Quit or shutdown event?