init(s)


    private function init():void
    {
     stage.frameRate = 1;
     ball = new animation_ch19_Ball();
     ball.y = stage.stageHeight / 2;
     ball.vx = 5;
     addChild(ball);
     timer = new Timer(20);
     timer.addEventListener(TimerEvent.TIMER, onTimer);
     timer.start();
    }
  

timer(s)


    private function onTimer(event:TimerEvent):void
    {
     ball.x += ball.vx;
     event.updateAfterEvent();
    }
   }
  }