我有一个 4 帧的场景。在第一帧上有两个按钮,Instructions
和Start
。Instructions
引导我到第 4 帧,那里是指令,并Start
带我到第 2 帧,那里是游戏。游戏结束后,我被带到第 3 帧,那里有一个显示主菜单的按钮,它应该将我重定向到主菜单。但是,主菜单按钮不起作用,原因Error #1009
如标题所示。我提前为任何愚蠢道歉,因为这是我第一次使用 AS3。这是代码:
public function projectFinal()
{
startBtn.addEventListener(MouseEvent.CLICK, startGame);
instructionBtn.addEventListener(MouseEvent.CLICK, instructions);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboardDown);
stage.addEventListener(KeyboardEvent.KEY_UP, keyboardUp);
specialTimer.addEventListener(TimerEvent.TIMER, spawnBonus);
monsterTimer.addEventListener(TimerEvent.TIMER, moveMonsters);
mainBtn.addEventListener(MouseEvent.CLICK, endGame);
backBtn.addEventListener(MouseEvent.CLICK, goBack);
}
function startGame(event:MouseEvent):void
{
gotoAndPlay(2);
gameStarted = true;
specialTimer.start();
monsterTimer.start();
spaceShip.score = 0;
//createMonsterRow(monsterRow);
}
function instructions(event:MouseEvent):void
{
gotoAndPlay(4);
trace ("pressed ins");
}
function endGame(event:MouseEvent):void
{
gotoAndPlay(1);
trace("pressed main");
}
function goBack(event:MouseEvent):void
{
gotoAndPlay(1);
}