1119:通过静态类型flash.utils:Timer的引用访问可能未定义的属性x

时间:2014-07-23 22:08:09

标签: actionscript-3 flash

我一直得到这个错误代码我是动作脚本的新手,我试图让多个物体从右向左移动。如果我采取错误的方法,任何建议都会很棒。

public class MainGame extends MovieClip
{
    private var enemy_startx = 600;
    private var enemy_starty = Math.floor(Math.random() * (1 + 400 - 1)) + 1;
    private var enemy:Timer = new Timer(200);

    public function startGame()
    {
        enemy.addEventListener(TimerEvent.TIMER,enemyHandler);
        enemy.start();
    }

    private function enemyHandler(event:TimerEvent):void
    {           
        var speed = 15;
        this.x = enemy_startx;
        this.y = enemy_starty;
        enemy_startx = enemy_startx + speed;    
    }
}

0 个答案:

没有答案