谁能告诉我什么是错我的退出按钮......甚至认为我使用的fscommand当我点击退出按钮不会关闭我的Flash游戏......另一个按钮是顺利..
包
{
导入flash.display使用*。
进口flash.events *。
进口flash.geom *。
进口的flash.text *。
进口flash.utils *。
进口flash.ui *。
进口flash.system.fscommand;
公共职能开始菜单()
{
btnPlay.addEventListener(MouseEvent.CLICK,gotoGame);
btnHelp.addEventListener(MouseEvent.CLICK,gotoHelp);
btnExit.addEventListener(MouseEvent.CLICK,gotoExit);
}
私有函数gotoExit(EVT:的MouseEvent)
{
btnExit.addEventListener(MouseEvent.CLICK,gotoExit);
fscommand的(跳槽,);
}
私有函数gotoHelp(EVT:的MouseEvent)
{
btnHelp.removeEventListener(MouseEvent.CLICK,gotoHelp);
gotoAndStop(帮助);
}
私有函数gotoGame(EVT:的MouseEvent)
{
btnPlay.removeEventListener(MouseEvent.CLICK,gotoGame);
gotoAndStop(游戏);
}
解决方案
据Adobe公司的 的fscommand()
和 System.exit()的
可仅适用于Flash Player的独立版本(和调试器 System.exit( )
这是不正确的)。
取code这个例子:
btn_fscommand_quit.addEventListener(
MouseEvent.CLICK,
功能(E:的MouseEvent):无效{
fscommand的(退出);
}
)
btn_system_exit.addEventListener(
MouseEvent.CLICK,
功能(E:的MouseEvent):无效{
尝试 {
System.exit(0);
}赶上(错误:错误){
log.text = error.toString();
}
}
)
这我测试和它的正常工作与一个发布版本的Flash Player 11:
您可以从的这里。
希望能有所帮助。
can anyone tell me what is wrong with my exit button...even thought i use "fscommand" when i click exit button it doesn't close my flash game...another button is going well..
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");
}
解决方案
According to Adobe, fscommand()
and System.exit()
are available only for Flash Player Standalone version (and debugger for System.exit()
which is not correct).
Take this example of code :
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();
}
}
)
Which I tested and it's working fine with a release version of Flash Player 11 :
You can download the fla (CS6), the swf and a projection (.exe) from here.
Hope that can help.