# Dynamically referencing MC

**URL:** <https://forum.kirupa.com/t/dynamically-referencing-mc/179035>\
**Category:** flash\
**Created:** [February 16, 2006, 4:15am UTC](https://forum.kirupa.com/t/dynamically-referencing-mc/179035 "2006-02-16T04:15:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![usmcyoo](https://avatars.discourse-cdn.com/v4/letter/u/a9a28c/32.png) [@usmcyoo](https://forum.kirupa.com/u/usmcyoo)\
**Post date:** [February 16, 2006, 4:15am UTC](https://forum.kirupa.com/t/dynamically-referencing-mc/179035/1 "2006-02-16T04:15:36Z")

</div>

I’m trying to detect a mouse rollovers on dynamically generated movie clips but I just can’t make it work. Only way I can make it work is to put actions inside the duplicated movieclip.

* * *

var total = 6;

myThumbs = new Array();

for(i=0; i\<total; i++) {  
this[“myThumb”+i] = this.attachMovie(“thumb”, “thumb\_mc”+i, i);  
this[“myThumb”+i].\_y = 400;  
this[“myThumb”+i].\_x = (Number(this[“myThumb”+i].\_width+6) \* i)+ 10;  
num = Number(i+1);  
this[“myThumb”+i].empty\_mc.\_alpha = 0;  
this[“myThumb”+i].empty\_mc.loadMovie(“images/img”+num+".jpg");  
this[“myThumb”+i].bg\_mc.\_xscale = 10;  
this[“myThumb”+i].bg\_mc.\_yscale = 10;

```
this["myThumb"+i].onRollOver = function() {
	trace(this["myThumb"+i]);
}

//check loading status of thumbnails
checkLoading(this["myThumb"+i].empty_mc);
myThumbs* = this["myThumb"+i]

```

}

Everything works fine except when I roll over the mc the value of this[“myThumb”+i] is undefined.
