简体   繁体   中英

AS3: Exit desktop flash player

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.

You can use

fscommand("quit");

This will terminate your swf.

Don't forget to import fscommand:

import flash.system.fscommand;

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.

怎么样:

NativeApplication.nativeApplication.exit();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM