# Actionscript question - For Loop

**URL:** <https://forum.kirupa.com/t/actionscript-question-for-loop/200771>\
**Category:** flash\
**Created:** [September 15, 2006, 12:13am UTC](https://forum.kirupa.com/t/actionscript-question-for-loop/200771 "2006-09-15T00:13:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soig](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Soig](https://forum.kirupa.com/u/Soig)\
**Post date:** [September 15, 2006, 12:13am UTC](https://forum.kirupa.com/t/actionscript-question-for-loop/200771/1 "2006-09-15T00:13:01Z")

</div>

Hey guys, I’m coming back out of the lazy coma that I chose to call retirement! 😉 But I am stumped on one that I think is not so hard for you guys. Basically, I want to apply the same property to many movie clips. So I used a for loop. The loop manages to apply the same code to every movie and that’s great, but it always makes the same movie go to frame 2 and 6 rather than applying it to frames 2 and six of that movie. The code is below and the FLA is enclosed. Thanks in advance for your help! 😉

[http://www.scarboni.com/temp/pictures.fla](http://www.scarboni.com/temp/pictures.fla)

> 

for (i = 0; i \< 4; i++) {  
\_root.work[“cellImgLoader” + i].id = i;  
\_root[“cellImgLoader” + i].onRollOver = function(){ \_root[“cellImgLoader” + i].gotoAndPlay(2); }  
\_root[“cellImgLoader” + i].onRollOut = function(){ \_root[“cellImgLoader” + i].gotoAndPlay(6); }  
}
