1084:错误:在需要程序结束前使用rightbrace

时间:2017-10-02 19:18:13

标签: actionscript-3 flash

我收到了语法错误,但我不知道导致错误的原因。我检查了所有代码,甚至重新编写了新代码,但我仍然无法避免错误。

这是我的代码:

Avoider.as

的代码
package
{
    import flash.display.MovieClip;
    import flash.utils.Timer;
    import flash.events.TimerEvent;

    public class AvoiderGame extends MovieClip
    {
        public var enemy:Enemy;
        public var avatar:Avvatar;
        public var gameTimer:Timer;

        public function AvoiderGame()
        {
                enemy = new Enemy();
                addChild( enemy );

                avatar = new Avatar();
                addChild( avatar );
                avatar.x = mouseX;
                avatar.Y = mouseY;

                gameTimer = new Timer( 25 );
                gameTimer.addEventListener( TimerEvent.TIMER, moveEnemyAndAvatar );
                gameTimer.start();
        }

        public function onTick(timerEvent:TimerEvent):void 
        {
                enemy.moveDownABit();
                avatar.x = mouseX;
                avatar.y = mouseY;

                if ( avatar.hitTestObject(enemy) ) { gameTimer.stop(); }
        }
    }
}

Enemy.as

的代码
package
{
    import flash.display.MovieClip;

    public class Enemy extends MovieClip
    {
        public function Enemy( startX:Number, startY:Number )
        { x = startX; y = startY;}

        public function moveDownABit():void
        { y = y + 3; }
    }
}

Avator.as

的代码
package
{
    import flash.display.MovieClip;
    public class Avatar extends MovieClip
    {
        public function Avatar()
        { /* is an empty function */ }
    }
}

0 个答案:

没有答案