0 Replies Latest reply on Aug 9, 2012 2:19 AM by poortip87

    How can we prevent application from closing?

    poortip87 Level 1

      Hi All!

       

      I am developing a panel UI for Photoshop. So, panel is Application type. I wanted to capture the application exit/quit/close event and perform some actions on the UI before application exit/quit/close. I added event listeners for the same. But, problem is that I receive these events after the UI has closed, so to perform any UI based changes, I cannot use it.

       

      I intended to prevent the close of my applicaiton until these actions at application exit/quit/close are complete. I searched the internet, and by far I have just seen the following example of an AIR application,

       

      private function onClose():void

      {
           var closingEvent:Event;
           closingEvent = new Event(Event.CLOSING, true, false);
           stage.nativeWindow.dispatchEvent(closingEvent);
           if (!closingEvent.isDefaultPrevented())
           {
                stage.nativeWindow.close();
           }

      }

       

      I want to do something similar for my application.

       

      Please guide.

      Thanks!