# Timed animation

**URL:** <https://forum.kirupa.com/t/timed-animation/263504>\
**Category:** Uncategorized\
**Created:** [June 16, 2008, 5:56pm UTC](https://forum.kirupa.com/t/timed-animation/263504 "2008-06-16T17:56:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jimmyosis](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jimmyosis](https://forum.kirupa.com/u/jimmyosis)\
**Post date:** [June 16, 2008, 5:56pm UTC](https://forum.kirupa.com/t/timed-animation/263504/1 "2008-06-16T17:56:18Z")

</div>

i’ve got 48 movieclips that i want to tween every 300 milliseconds or so.

the instance names on my mc’s are t1\_mc, t2\_mc, t3\_mc, etc. up to t48\_mc.

i’ve tried a for loop and a setInterval statement and i know i’m missing something.

one simple function that will give me:  
new Tween (t1\_mc, “\_y”, Strong.easeOut, t1\_mc.\_y+100, t1\_mc.\_y, 1, true);  
every 300 milliseconds is all i’m looking for.

any help is greatly appreciated.

thanks.

---

<div class="post-metadata">

**Author:** ![Adam1](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Adam1](https://forum.kirupa.com/u/Adam1)\
**Post date:** [June 16, 2008, 6:02pm UTC](https://forum.kirupa.com/t/timed-animation/263504/2 "2008-06-16T18:02:25Z")

</div>

What code did you use for setInterval? That should work for what you’re looking for.

---

<div class="post-metadata">

**Author:** ![jimmyosis](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jimmyosis](https://forum.kirupa.com/u/jimmyosis)\
**Post date:** [June 16, 2008, 6:09pm UTC](https://forum.kirupa.com/t/timed-animation/263504/3 "2008-06-16T18:09:23Z")

</div>

i know i’m not referencing my movieclip correctly in the tween:

[INDENT]var intervalId:Number;  
var count:Number = 1;  
var max:Number = 48;  
var duration:Number = 300;

function animateMC():Void {  
trace("count: " + count);  
var letter:String = “t”+count;  
new Tween (letter+\_mc, “\_y”, Strong.easeOut, letter+\_mc.\_y+100, letter+\_mc.\_y, 1, true);  
if(count \>= max) {  
clearInterval(intervalId);  
}  
count++;  
}

intervalId = setInterval(this, “animateMC”, duration);  
[/INDENT]
