# Creating MC's dynamically

**URL:** <https://forum.kirupa.com/t/creating-mcs-dynamically/193751>\
**Category:** Uncategorized\
**Created:** [July 18, 2006, 7:59am UTC](https://forum.kirupa.com/t/creating-mcs-dynamically/193751 "2006-07-18T07:59:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![elektrophunk](https://avatars.discourse-cdn.com/v4/letter/e/e8c25b/32.png) [@elektrophunk](https://forum.kirupa.com/u/elektrophunk)\
**Post date:** [July 18, 2006, 7:59am UTC](https://forum.kirupa.com/t/creating-mcs-dynamically/193751/1 "2006-07-18T07:59:03Z")

</div>

[FONT=Arial]Hi![/FONT]

[FONT=Arial]I need some serious help here. I’m trying to create x movieclips on the fly and loading each with a unique image. Each dynamically created movieclip shall have it’s on onRelease function that shall be invoked when pressed. I’m doing the following: [/FONT]

```auto
 
for(var i:Number = 0; i<2; i++){
var objectName:String = "stillLife_" +i;
_root.createEmptyMovieClip(objectName, _root.getNextHighestDepth());
_root[objectName].loadMovie(objectContainer*.getThumbImagePath());
_root[objectName]._x = (i * 150) + 200;
_root[objectName].onRelease = function():Void {
}
}

```

[FONT=Arial]It all works except for the onRelease part. Please help me! I’m stuck!!![/FONT]
