有人能告诉我退出button...even的地方出了什么问题吗?我认为我使用了"fscommand“,当我单击”退出“按钮时,它没有关闭我的闪存game...another按钮。
package
{
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
import flash.system.fscommand;
public function startMenu()
{
btnPlay.addEventListener(MouseEvent.CLICK, gotoGame);
btnHelp.addEventListener(MouseEvent.CLICK, gotoHelp);
btnExit.addEventListener(MouseEvent.CLICK, gotoExit);
}
private function gotoExit(evt:MouseEvent)
{
btnExit.addEventListener(MouseEvent.CLICK, gotoExit);
fscommand("quit", "");
}
private function gotoHelp(evt:MouseEvent)
{
btnHelp.removeEventListener(MouseEvent.CLICK, gotoHelp);
gotoAndStop("Help");
}
private function gotoGame(evt:MouseEvent)
{
btnPlay.removeEventListener(MouseEvent.CLICK, gotoGame);
gotoAndStop("game");
}
发布于 2015-02-28 13:23:33
根据Adobe的说法,fscommand()和System.exit()只适用于Flash独立版本(以及System.exit()的调试器,这是不正确的)。
以下面的代码为例:
btn_fscommand_quit.addEventListener(
MouseEvent.CLICK,
function(e:MouseEvent):void {
fscommand('quit');
}
)
btn_system_exit.addEventListener(
MouseEvent.CLICK,
function(e:MouseEvent):void {
try {
System.exit(0);
} catch(error:Error){
log.text = error.toString();
}
}
)我对它进行了测试,它在Flash 11的发布版本中运行得很好:

您可以从CS6下载fla (.exe)、swf和投影(.exe)。
希望能帮上忙。
发布于 2015-02-27 13:52:08
在您的gotoExit方法中,您写道:
btnExit.addEventListener(MouseEvent.CLICK, gotoExit);而不是:
btnExit.removeEventListener(MouseEvent.CLICK, gotoExit);https://stackoverflow.com/questions/28765438
复制相似问题