# Assign onRelease event

**URL:** <https://forum.kirupa.com/t/assign-onrelease-event/228084>\
**Category:** Uncategorized\
**Created:** [June 5, 2007, 8:31am UTC](https://forum.kirupa.com/t/assign-onrelease-event/228084 "2007-06-05T08:31:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bsprathapsimha](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@bsprathapsimha](https://forum.kirupa.com/u/bsprathapsimha)\
**Post date:** [June 5, 2007, 8:31am UTC](https://forum.kirupa.com/t/assign-onrelease-event/228084/1 "2007-06-05T08:31:17Z")

</div>

Hi,

I am using a private method in my class File. In this method, I am loading XML file and generating few thumbnails. Everything is going fine and running smooth. I am facing problem in assigning onRelease events to these movie clips.

for (var i:Number = 0; i\<this.firstChild.childNodes.length; i++) {  
duplicateMovieClip(“category\_Mc”, “category\_Mc”+i, \_root.getNextHighestDepth());  
eval(“category\_Mc”+i).loadMovie(this.firstChild.childNodes\*.attributes.src);  
eval(“category\_Mc”+i).\_x = mcX;  
eval(“category\_Mc”+i).\_y = mcY;  
mcX += Number(this.firstChild.childNodes\*.attributes.width)+30;  
eval(“category\_Mc”+i).onRelease =function(){  
// some code here  
}  
}

I am using for loop and generating tumbnails. My only problem is, I want to assign onRelease events to these duplicated Movie Clips. I am using below code in for loop to assign onRelease:-

eval(“category\_Mc”+i).onRelease =function(){  
// some code here  
}

So my doubt is, how to assign onRlease event to thse duplicated Move Clips.

Do you know the solution?

Thank you
