# Question FMX duplicate MOVIE CLIPS

**URL:** <https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536>\
**Category:** Uncategorized\
**Created:** [August 3, 2003, 8:27pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536 "2003-08-03T20:27:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagunco](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jagunco](https://forum.kirupa.com/u/jagunco)\
**Post date:** [August 3, 2003, 8:27pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/1 "2003-08-03T20:27:50Z")

</div>

hi I have this code that duplicates an MC on stage , my problem is , after the duplication i know every MC as a unique name, but I can´t access them, I don´t understand why, can someone explain tthis to me please tahnks

/////

button\_mc.\_visible = false;

var maxClips = 10;

var i = 0;

function addClip() {

```
i++;
	newClip = _root.button_mc.duplicateMovieClip("newClip"+i, i);
	newClip._y = i*(newClip._height+10);
 maxClips variable
if (i&gt;=maxClips) {
	//clear the interval and stop running this function
	clearInterval(addClipsInterval);
}

```

}

var addClipsInterval = setInterval(addClip, 100);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2003, 9:03pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/2 "2003-08-03T21:03:17Z")

</div>

Hoi

just access them with  
\_root.newClip-and a num 1-10

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2003, 9:38pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/3 "2003-08-03T21:38:35Z")

</div>

but it dosen´t work

any sugestions

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2003, 9:50pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/4 "2003-08-03T21:50:42Z")

</div>

if you are accessing it right away the newClip5 will not be make jet so you will have the access when the Interval is finished  
try this…

```auto

_root.onEnterFrame = function(){
trace(newClip5)
}

```

😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 3, 2003, 10:36pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/5 "2003-08-03T22:36:22Z")

</div>

I’ll bet your problem is that you are trying to use newClip to access each newly duplicated MC. I think the problem is that newClip isn’t an object like you want it to be. You need to first duplicate the MC and then reference it into your newClip using eval(). Something like this:

[AS]  
\_root.xyzMC.duplicateMovieClip(“blah”+i,x);  
newClip = eval("\_root.xyzMC.blah" + i);  
[/AS]

Now try to access something like newClip.\_y or whatever. Im like 99% sure thats the right path for you. Whenever I try something like this, I use code like:

[AS]  
\_root.xyzMC.duplicateMovieClip(“blah”\_i,x);  
eval("\_root.xyzMC.blah" + i).\_y;  
[/AS]

It saves the trouble of creating a reference object and all that. Lemme know if that helped.

Shaheeb R.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 4, 2003, 3:47pm UTC](https://forum.kirupa.com/t/question-fmx-duplicate-movie-clips/27536/6 "2003-08-04T15:47:44Z")

</div>

Put them in an array:

```auto
button_mc._visible = false;
myClips = [] ;
var maxClips = 10;

var i = 0;

function addClip() {
	i++;
	newClip = _root.button_mc.duplicateMovieClip("newClip"+i, i);
	myClips.push ( newClip ) ;
	newClip._y = i*(newClip._height+10);
	if (i>=maxClips) {
	//clear the interval and stop running this function
		clearInterval(addClipsInterval);
	}
}

var addClipsInterval = setInterval(addClip, 100); 

```

Then you can access them with myClips[2] for instance.

pom 🙂
