# Remembering iteration numbers

**URL:** <https://forum.kirupa.com/t/remembering-iteration-numbers/274141>\
**Category:** Uncategorized\
**Created:** [October 25, 2008, 8:09pm UTC](https://forum.kirupa.com/t/remembering-iteration-numbers/274141 "2008-10-25T20:09:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hommer](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@Hommer](https://forum.kirupa.com/u/Hommer)\
**Post date:** [October 25, 2008, 8:09pm UTC](https://forum.kirupa.com/t/remembering-iteration-numbers/274141/1 "2008-10-25T20:09:18Z")

</div>

I have this code.

```auto
for (i=1; i<6; i++) {
	this.attachMovie("myMovie","unit"+i,i);
	this["unit"+i]._x = i*100;
	this["unit"+i].onRelease = function() {
		trace("Unit number " + i + " was pressed");
	};
}

```

I wan’t to trace the number (i) of the button that is pressed.  
But no matter what button I press, I always get the value ‘6’ on my trace.  
Isn’t there a way to store the a value for i in each movie clip attached?
