# Multi Buttons in for loop

**URL:** <https://forum.kirupa.com/t/multi-buttons-in-for-loop/324014>\
**Category:** flash\
**Created:** [July 28, 2011, 2:15pm UTC](https://forum.kirupa.com/t/multi-buttons-in-for-loop/324014 "2011-07-28T14:15:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tattered](https://avatars.discourse-cdn.com/v4/letter/t/b9e5f3/32.png) [@Tattered](https://forum.kirupa.com/u/Tattered)\
**Post date:** [July 28, 2011, 2:15pm UTC](https://forum.kirupa.com/t/multi-buttons-in-for-loop/324014/1 "2011-07-28T14:15:35Z")

</div>

Hey guys…

If I have 16 buttons inside a for loop, how would I trace back the number that was pressed.

NumPageButtons = 16

for(i=1; i\<=NumPageButtons; i++){  
tempMC = eval(“page”+i+"\_mc")  
tempMC.onRelease = function(){  
trace("i = " + i)  
}  
}

when I do a trace it gives me 16 not the number (current button ) that was pressed
