1 Reply Latest reply on May 21, 2009 9:09 PM by Michael Borbor

    Interrupt system shutdown with Adobe Air

    dSpen

      I'm trying to get my Air app to display the NativeWindow to the user (the app is normally hidden down in the system tray) when the system is shutdown, similar to how MS Word can pause shutdown to prompt the user to save. I'm using the following code currently which works nicely if the exit button is pressed, but it doesn't work when the system is shut down. I'm using a custom chrome. Any help would be much appreciated.

       

      NativeApplication.nativeApplication.addEventListener(Event.EXITING, this.Application_Exiting);

       

      private function SysTrayExit_Select(e: Event):void{

            this.applicationExit();

      }

       

      public function applicationExit():void {

          var exitingEvent:Event = new Event(Event.EXITING, false, true);

       

          NativeApplication.nativeApplication.dispatchEvent(exitingEvent);

       

          if (!exitingEvent.isDefaultPrevented()) {

       

              NativeApplication.nativeApplication.exit();

       

          } 

      }

       

      private function Application_Exiting(e: Event): void {

       

       

            e.preventDefault();

       

            Alert.show("Exiting");

            ShowTaskEntry(); 

      }