-1

4フレームのシーンがあります。最初のフレームには2つのボタンとが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);
    }
4

1 に答える 1

0

すべてのフレームに ActionScript があり、stop(); がない場合。コードの各フレームの最後で、アプリケーションは 1 つのフレームから次のフレームにジャンプします。stop(); を入れます。goBack 関数の後、および他のすべてのフレームで、それが機能するかどうかを確認します。

于 2012-11-28T01:16:15.637 に答える