如何在Flash应用程序中创建退出按钮 [英] How to create exit button in Flash application
问题描述
我正在创建一个Flash应用程序,它将以exe
格式导出,并且不会在浏览器中运行.我想在舞台内添加退出按钮,但我不知道该如何使用ActionScript 3.
I'm creating a Flash Application that will be exported in exe
format and it's not going to run in browser. I want to add an exit button inside stage but I don't know how to do that with ActionScript 3.
我记得在ActionScript 2中使用fscommand
是可能的,但是在AS3中不起作用.
I remember that it was possible with fscommand
in ActionScript 2 but it's not working in AS3.
我到处搜索过,但每个人都试图在浏览器环境中而不是Flash应用程序中关闭弹出窗口,标签页或窗口.
I've searched everywhere but everyone is trying to close a popup or tab or window all in browser environment not a Flash app.
推荐答案
当您现在可以将as3应用程序导出为AIR时,为什么要使用.exe格式? 但 如果您仍然想要该exe,我认为这会起作用
Why would use a .exe format when you can now export as3 application as AIR? BUT If you still want the exe, I think that this will work
import flash.system.fscommand;
//Then you can use the following function for the button click handler:
private function clickHandler(event:MouseEvent):void {
fscommand("quit");
}
如果您决定尝试AIR解决方案,这是命令
If you decide to try the AIR solution, this is the command
import flash.desktop.NativeApplication;
nativeApp.nativeApplication.exit();
这篇关于如何在Flash应用程序中创建退出按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!