2
votes

How do I exit the desktop flash player using Actionscript 3?

System.exit(0);

Results in

SecurityError: Error #2018: System.exit is only available in the standalone Flash Player.

The error appears both while previewing the project in Flash CS6 and while playing the exported swf-file in Flash Player Debugger.

3

3 Answers

3
votes

You can use

fscommand("quit");

This will terminate your swf.

Don't forget to import fscommand:

import flash.system.fscommand;
2
votes

There is a difference between Flash Player and the stand alone version.

When you export a fla, you export a swf that is played by flash player. Its not stand alone.

Just compile it, then go to File -> Create projector. Now its a stand alone and System.exit(0) should work.

0
votes

How about:

NativeApplication.nativeApplication.exit();