# Animation: Timer vs ENTER\_FRAME event

**URL:** <https://forum.kirupa.com/t/animation-timer-vs-enter-frame-event/323636>\
**Category:** flash\
**Created:** [July 10, 2011, 7:20pm UTC](https://forum.kirupa.com/t/animation-timer-vs-enter-frame-event/323636 "2011-07-10T19:20:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thovas](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@Thovas](https://forum.kirupa.com/u/Thovas)\
**Post date:** [July 10, 2011, 7:20pm UTC](https://forum.kirupa.com/t/animation-timer-vs-enter-frame-event/323636/1 "2011-07-10T19:20:43Z")

</div>

I use 2 options when i comes to animationg objects with Action Script

1. Timer based animation

```php
initTimer = new Timer(1000/fps);
initTimer.addEventListener(TimerEvent.TIMER, moveItem);
initTimer.start();
function moveItem(event:TimerEvent){
     mc.x += speed;
}

```

1. ENTER\_FRAME event based animation

```php
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
