# duplicateMovieClip problem

**URL:** <https://forum.kirupa.com/t/duplicatemovieclip-problem/159071>\
**Category:** flash\
**Created:** [August 14, 2005, 2:06pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problem/159071 "2005-08-14T14:06:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chic0](https://avatars.discourse-cdn.com/v4/letter/c/c5a1d2/32.png) [@chic0](https://forum.kirupa.com/u/chic0)\
**Post date:** [August 14, 2005, 2:06pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problem/159071/1 "2005-08-14T14:06:54Z")

</div>

Ok guys, I have an mc of which I make some duplicates, and then I want a function to be executed on all of those duplicates.

I tried this:

```auto
for (i=1; i<amount; i++) {
	mcInstance0.duplicateMovieClip("mcInstance"+i, this.getNextHighestDepth(), {_x:random(400)});
	mcInstance*.theFunctionIWantToExecute();
}

```

But that doesnt work.  
What **[color=black]does[/color]** work is:

```auto
for (i=1; i<amount; i++) {
 	mcInstance0.duplicateMovieClip("mcInstance"+i, this.getNextHighestDepth(), {_x:random(400)});
 	}
mcInstance0.theFunctionIWantToExecute();
mcInstance1.theFunctionIWantToExecute();
mcInstance2.theFunctionIWantToExecute();
mcInstanceN.theFunctionIWantToExecute();

```

But that’s silly. Really silly when I need like 100 duplicates.  
So what’s wrong with my first code? 😊

Thanks in advance.
