Advertisement
benjisimon

Handle closing event on a mac

Aug 17th, 2011
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. /*
  2. * How to gracefully handle the closing event on a mac
  3. */
  4. napp.openedWindows[0].addEventListener(Event.CLOSING,
  5. function(e:Event):void {
  6. var w:NativeWindow = e.currentTarget as NativeWindow;
  7. if(w.active) {
  8. e.preventDefault();
  9. napp.openedWindows[0].visible = false;
  10. } else {
  11. napp.exit();
  12. }
  13. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement