AIR: Closing all possible Windows before the Application Quits


/ Published in: ActionScript 3
Save to your folder(s)

If you don't do this, then there's a chance that a user will quit the program but windows will still be viewable.


Copy this code and paste it in your HTML
  1. this.nativeWindow.addEventListener(Event.CLOSING,
  2. function(e:Event):void
  3. {
  4. e.preventDefault();
  5. for (var i:int = NativeApplication.nativeApplication.openedWindows.length - 1; i >= 0; --i)
  6. {
  7. NativeWindow(NativeApplication.nativeApplication.openedWindows[i]).close();
  8. }
  9. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.