Dynamically referencing MC

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.