主文件
package{
import flash.display.*;
import flash.events.Event;
public class main extends MovieClip{
public function main(){
changeState(null,"menu");
}
public function changeState( CurrentState, NextState){
if(CurrentState != null){
removeChild(CurrentState);
}
if(NextState == "menu"){
var mm:mainMenu = new mainMenu(changeState);
addChild(mm);
}
else if(NextState == "game"){
var g:CollapsingBlocks = new CollapsingBlocks(changeState);
addChild(g);
}
else if(NextState == "exit"){
}
}
}
}
maniMenu.as
package{
import flash.display.*;
import flash.events.MouseEvent;
import flash.events.Event;
public class mainMenu extends MovieClip{
var theCallBackFunction:Function;
public function mainMenu(callBack){
var btnPlay:mmPlay = new mmPlay();
btnPlay.addEventListener(MouseEvent.MOUSE_DOWN, btnP_Button);
btnPlay.x=width/2=btnPlay.width/2;
btnPlay.y=height/2=btnPlay.height/2;
addChild(btnPlay);
var btnExit:mmExit = new mmExit();
btnExit.addEventListener(MouseEvent.MOUSE_DOWN, btnE_Button);
btnExit.x=width/2=btnExit.width/2;
btnExit.y=height/2=btnExit.height/2;
btnExit.y + btnExit.height + 4;
addChild(btnExit);
theCallBackFunction = callBack;
}
public function btnP_button(e:MouseEvent){
theCallBackFunction (this, "game");
return;
}
public function btnE_button(e:MouseEvent){
theCallBackFunction (this, "exit");
return;
}
}
}
CollapsingBlock.as
..
public function startCollapsingBlocks(callBack) {
..
如何解决这个问题呢?(错误 1136),我使用的是 Flash CS6 版本。游戏文件名为 CollapsingBlocks.fla,主函数名为 startCollapsingBlocks,我试图在这里制作简单的 Flash 游戏菜单,带有 2 个按钮(播放和退出)。