# Tween class and loops

**URL:** <https://forum.kirupa.com/t/tween-class-and-loops/194231>\
**Category:** flash\
**Created:** [July 21, 2006, 2:20pm UTC](https://forum.kirupa.com/t/tween-class-and-loops/194231 "2006-07-21T14:20:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SlowRoasted](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@SlowRoasted](https://forum.kirupa.com/u/SlowRoasted)\
**Post date:** [July 21, 2006, 2:20pm UTC](https://forum.kirupa.com/t/tween-class-and-loops/194231/1 "2006-07-21T14:20:26Z")

</div>

I hate writing out tweens for each movement I do. But I can seem to get loops to work with tween class the way I want it. Say i have a bunch of buttons that I want to alpha up one after another. There are 6 buttons with instance names p1, p2, p3, p4, p5 and p6. I write some code like this

```auto

import mx.transitions.Tween; 
import mx.transitions.easing.*;

for(i=1; i<7; i++) {
  var blah:Tween = new Tween(eval("p"+i), "_alpha", Strong.easeOut, 0, 100, .5, true);
}

```

Now that works for alphaing them all up at once. But is there a way to loop through and alpha them one after the other? Like possibly put a pause after each time it loops. I know about onMotionFinished but I can’t figure out how to implement it.

I really just hate writing it all out, making a loop would cut out a lot of code.

thx
