# onEnterFrame IN for loop

**URL:** <https://forum.kirupa.com/t/onenterframe-in-for-loop/310619>\
**Category:** flash\
**Created:** [June 15, 2010, 6:09am UTC](https://forum.kirupa.com/t/onenterframe-in-for-loop/310619 "2010-06-15T06:09:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sarumitai](https://avatars.discourse-cdn.com/v4/letter/s/c2a13f/32.png) [@sarumitai](https://forum.kirupa.com/u/sarumitai)\
**Post date:** [June 15, 2010, 6:09am UTC](https://forum.kirupa.com/t/onenterframe-in-for-loop/310619/1 "2010-06-15T06:09:50Z")

</div>

I’ve dynamically added some boxes with text boxes in them that pick up a letter from an array.

How do I get each box to move across the stage? I can’t find where to put the onEnterFrame part. Within the for loop?

I can hard code it and it works, but there should be a way.

[AS]  
for(i=0;i\<moji.length;i++) {  
box.duplicateMovieClip(“box”+i,this.getNextHighestDepth(),{\_x:(i_20)+480,\_y:i_20});  
this[“box”+i].txt.text = moji\*;  
onEnterFrame = function() {  
this[“box”+i].\_x -= (10+i);  
}  
}  
[/AS]
