# Help with dynamic variables

**URL:** <https://forum.kirupa.com/t/help-with-dynamic-variables/227615>\
**Category:** Uncategorized\
**Created:** [May 31, 2007, 7:21pm UTC](https://forum.kirupa.com/t/help-with-dynamic-variables/227615 "2007-05-31T19:21:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TylerNZ](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tylernz/32/415_2.png) [@TylerNZ](https://forum.kirupa.com/u/TylerNZ)\
**Post date:** [May 31, 2007, 7:21pm UTC](https://forum.kirupa.com/t/help-with-dynamic-variables/227615/1 "2007-05-31T19:21:07Z")

</div>

Hi peps … ok, so I have a for loop that is supposed to create an emptyMC and then place an image inside that emptyMC then attach a rollOver state to that emptyMC.

I’m having trouble understanding how to create the dynamic variables needed to create different rollOver states.

Here’s my code:  
[AS]  
function loadThumbs(){  
for(var i:Number=0; i\<4; i++){  
var newThumbPic:MovieClip = eval(“thumbPic”+i);  
newThumbPic = thumbs.createEmptyMovieClip(“thumbPic”+i,thumbs.getNextHighestDepth());  
newThumbPic.\_y = i_65;  
var mcLoader:MovieClipLoader = new MovieClipLoader();  
mcLoader.addListener(thumbs);  
thumbs.onLoadComplete = function(){  
newThumbPic.onRollOver = function():Void {  
\_root.thumbNoteOut(myMC);  
}  
newThumbPic.onRollOut = function():Void {  
\_root.thumbNoteIn(myMC);  
}  
}  
mcLoader.loadClip(“flash/”+\_root.thumbs\_array_,newThumbPic);  
}  
}  
[/AS]

or how do I get the rollOver on thumbPic+i ?  
Can anyone help me?

Thx!
