1

Seems System.exit(0) and flash.system.System.exit(0) both throw the error "[Fault] exception, information=SecurityError: Error #2018: System.exit is only available in the standalone Flash Player."

I'm creating a fullscreen app and im simply want to add a close button that will close all windows and exit (i have a secondary window via NativeWindow open). Tons and tons of googling any nothing. Makes me wonder if im missing something super simple since all "chromless" apps would have to have this.

Poking around I found stage.NativeWindow but closing that does not exit the whole app.

*note I am building and testing in flashdevlop 4.0 with pure as3, no flex.

Ryan Mills
  • 939
  • 1
  • 10
  • 23
  • pls search SO next time before you post your question: http://stackoverflow.com/questions/2837648/how-to-exit-an-air-application-from-an-actionscript-library thx – Philipp Kyeck Jul 21 '11 at 11:09
  • as I pointed out I had searched quite a bit, thanks for the RTFM thou. – Ryan Mills Jul 21 '11 at 19:38
  • 1
    @pkyeck, The question you referenced is unrelated to this question. Sure, it's regarding exiting an air app, but the issue that Ryan was having is not the same as the issue in the post you've referenced. Please read the full question as well as follow up posts/comments before harassing relatively new members on their site etiquette in error. –  Feb 07 '12 at 16:04
  • 1
    @ascension-systems sorry if i was too rude but i couldn't believe that he wasn't able to find anything (google and/or SO) about this topic. and a quick scan showed a couple of answers and the one i was refering to mentioned the important part: `NativeApplication.nativeApplication.exit();` but again, sorry if i came across rude (i tried using pls and thx though ;) ). and "harassing" is definitely too harsh a word. – Philipp Kyeck Feb 07 '12 at 19:28
  • Ok my bad. I just looked at the answer you referenced and it is a different issue. –  Feb 07 '12 at 23:32

1 Answers1

12

NativeApplication.nativeApplication.exit();

When in doubt, check the docs! :)

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/desktop/NativeApplication.html#exit()

  • seems flashdevlop did not code hint that class correctly, just copy pasting it in worked, figures. – Ryan Mills Jul 21 '11 at 19:38
  • I think you have to pass zero as parameter to exit method. – giannis christofakis Feb 07 '12 at 15:31
  • 1
    Passing 0 is not required @giannosfor, as you can see from the docs it is the default value for the argument. Passing 0 simple means that the application has closed without error. You can pass in another value but that usually indicates some sort of error. You would only ever need this if you're launching your native executable from another application, which will read the exit value of the program. –  Feb 07 '12 at 16:00