init(s)
private function init():void {
ball = new animation_ch03_Ball();
addChild(ball);
ball.x = 0;
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
frame(s)
public function onEnterFrame(event:Event):void {
// the book seems to make a mistake here
// ball.x = centerX + Math.sin(angle) * radiusX;
// ball.y = centerY + Math.cos(angle) * radiusY;
ball.x = centerX + Math.cos(angle) * radiusX;
ball.y = centerY + Math.sin(angle) * radiusY;
angle += speed;
}
}
}