2013-04-29 144 views
2

如何使用Actionscript 3退出桌面Flash播放器?AS3:退出桌面Flash播放器

System.exit(0); 

结果

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

错误都出现预览时,在Flash CS6的项目,并同时打在Flash Player调试器导出的SWF文件。

回答

2

Flash Player和独立版本之间有区别。

当您导出fla时,会导出由flash player播放的swf。它并不孤单。

只需编译它,然后进入文件 - >创建投影机。现在它的独立和System.exit(0)应该可以工作。

+0

我创建了一个.exe和.app文件,并在Windows和OSX但没有工作测试。这只是回到项目的开始。我想让它关闭窗户。 – 2013-04-29 20:28:12

+0

http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html – Discipol 2013-04-29 20:32:50

+0

这对我有何帮助? – 2013-04-30 07:32:28

3

您可以使用

fscommand("quit"); 

这将终止您的SWF。

不要忘了进口的fscommand:

import flash.system.fscommand; 
0

如何:

NativeApplication.nativeApplication.exit();