# \[Flash 8\]Referencing dynamic MCs created using attachMovie

**URL:** <https://forum.kirupa.com/t/flash-8-referencing-dynamic-mcs-created-using-attachmovie/316984>\
**Category:** flash\
**Created:** [December 7, 2010, 8:02am UTC](https://forum.kirupa.com/t/flash-8-referencing-dynamic-mcs-created-using-attachmovie/316984 "2010-12-07T08:02:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trex](https://avatars.discourse-cdn.com/v4/letter/t/dfb087/32.png) [@trex](https://forum.kirupa.com/u/trex)\
**Post date:** [December 7, 2010, 8:02am UTC](https://forum.kirupa.com/t/flash-8-referencing-dynamic-mcs-created-using-attachmovie/316984/1 "2010-12-07T08:02:27Z")

</div>

Hi,  
i’ve been breaking my head to get this thing working, so any help would be appreciated!

Here it is.  
I am adding a bunch of MC’s(linkage ID:buttonHolder) dynamically using a for loop and attachMovie. If I want to dynamically add an onRelease function to each of those MCs,so that each of them links to different links how would I accomplish that? here’s where i’ve reached so far…

var depth:Number=0;  
var nextY:Number=77;

for (i=0; i\<5; i++)  
{  
var tempMC:MovieClip=attachMovie(“buttonHolder”,“buttonHolder”+i,depth++);  
tempMC.\_x=17;  
tempMC.\_y=nextY;  
nextY+=tempMC.\_height+5;

tempMC.onRelease=function () {  
//here i want to place the AS dat will make each MC placed on the stage to link to different links.e.g. 1st button links to link1, 2nd to link2 and so on  
}
