# Creating Tweens in a loop

**URL:** https://forum.kirupa.com/t/creating-tweens-in-a-loop/195361
**Category:** flash
**Created:** [July 31, 2006, 6:04am UTC](https://forum.kirupa.com/t/creating-tweens-in-a-loop/195361 "2006-07-31T06:04:34Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Hofuzz](https://avatars.discourse-cdn.com/v4/letter/h/48db29/32.png) [@Hofuzz](https://forum.kirupa.com/u/Hofuzz)
#### Post date: [July 31, 2006, 6:04am UTC](https://forum.kirupa.com/t/creating-tweens-in-a-loop/195361/1 "2006-07-31T06:04:34Z")

</div>

Hi All,

I’m stuck on trying to create a bunch of motion tweens in a loop  
(to create an infinitely scrolling puzzle):

I know the ‘var’ part of this doesnt work…

```auto
for (x=1; x<20; x++) {
  var ["myTween"+x]:Object = 
     new Tween(["myMC"+x], "_y", start, end, duration, true);
}

```

so I tried to put the tweens in an array:

```auto

hitTween = new Array();
for (x=1; x<20; x++) {
  myTween[x] = new Tween(["myMC"+x], "_y", start, end, duration, true);
  hitTween[x].onMotionFinished =
  function() {trace("here we go again");};
}

```

But that doesn’t seem right either, the tweens don’t start visually in this case. However, the onMotionFinished function does get triggered.

I’d appreciate any pointers in the right direction, thank you!

Thanks for reading my 1st post!

Cheers,  
Hofuzz
