I use 2 options when i comes to animationg objects with Action Script
- Timer based animation
initTimer = new Timer(1000/fps);
initTimer.addEventListener(TimerEvent.TIMER, moveItem);
initTimer.start();
function moveItem(event:TimerEvent){
mc.x += speed;
}
- ENTER_FRAME event based animation
var time:int = getTimer();
addEventListener(Event.ENTER_FRAME, moveItem);
function moveItem(event:Event){
var passedTime:int = getTimer() - time;
mc.x += speed*(passedTime/1000);
time += passedTime;
}
Both of this options work ideal for my needs and they produce smooth animation. My question is witch one is better and why? And is there more ways to animate objects with action script?
Regards Thovas