如何在Flash应用程序中创建退出按钮

Far*_* Rn 5 actionscript-3 flash-cs5

我正在创建一个将以exe格式导出的Flash应用程序,它不会在浏览器中运行.我想在舞台内添加一个退出按钮,但我不知道如何使用ActionScript 3.

我记得fscommand在ActionScript 2 中它是可能的,但它在AS3中不起作用.

我到处搜索,但每个人都试图在浏览器环境中关闭弹出窗口或标签或窗口,而不是Flash应用程序.

Sr.*_*hie 9

当您现在可以将as3应用程序导出为AIR时,为什么会使用.exe格式?但如果你仍然想要exe,我认为这将有效

 import flash.system.fscommand;

 //Then you can use the following function for the button click handler:

 private function clickHandler(event:MouseEvent):void {
      fscommand("quit");
 }
Run Code Online (Sandbox Code Playgroud)

如果您决定尝试AIR解决方案,那么这就是命令

 import flash.desktop.NativeApplication;
 nativeApp.nativeApplication.exit();
Run Code Online (Sandbox Code Playgroud)