# For loop troubles

**URL:** <https://forum.kirupa.com/t/for-loop-troubles/179678>\
**Category:** flash\
**Created:** [February 22, 2006, 6:17am UTC](https://forum.kirupa.com/t/for-loop-troubles/179678 "2006-02-22T06:17:52Z")\
**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:** [February 22, 2006, 6:17am UTC](https://forum.kirupa.com/t/for-loop-troubles/179678/1 "2006-02-22T06:17:52Z")

</div>

Hi, I created this for loop so that I an use it to set the properties for buttons. Starting from img1 - img20. However when I go to click, it always says img20. How do I get it to register each one?

> 

//For loop creates function that can be reused for up down and over states  
for(i=1;i\<20;i++) {

```
_root.mcHolder["img"+i].onRelease = function() {
 hImgLoader.loadMovie("http://www.sergprotector.com/glitteration/images/test/img" +* +".jpg");
vImgLoader.unloadMovie();}

```

}
