# duplicateMovieClip problemo, help pls

**URL:** <https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358>\
**Category:** flash\
**Created:** [May 14, 2008, 6:25pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358 "2008-05-14T18:25:34Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo75](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@Leo75](https://forum.kirupa.com/u/Leo75)\
**Post date:** [May 14, 2008, 6:25pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/1 "2008-05-14T18:25:34Z")

</div>

Hi there…  
iam TRYING to duplicate a movie clip using this code:

```auto

for (i = 1; i < 30; i++) 
{
   duplicateMovieClip(_root.mc_l_1["area_test"], _root.mc_l_1["area_test_" + i], _root.mc_l_1.getNextHighestDepth());
} 
po_x=-101.5;
po_y=-1109.1;
t=1;
 for (c = 1; c < 30; c++) 
   {
    _root.mc_l_1["area_test_" + c]._x = po_x;
    _root.mc_l_1["area_test_" + c]._y = po_y;
    po_y=po_y+ 102;
  if(t==19)
  {
   t=0;
   po_x = po_x+120;
   po_y=-1109.1;
  }
  t++;
 }

```

But for some WEIRD reason that i dont understand, i just cant.  
Any idea?  
thanks.  
Leo.

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [May 15, 2008, 6:47am UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/2 "2008-05-15T06:47:05Z")

</div>

everywere you have  
po\_x  
and po\_y  
did you forget it should be ‘.’ ?  
po.\_x

etc

---

<div class="post-metadata">

**Author:** ![Jephz](https://avatars.discourse-cdn.com/v4/letter/j/58956e/32.png) [@Jephz](https://forum.kirupa.com/u/Jephz)\
**Post date:** [May 15, 2008, 9:27am UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/3 "2008-05-15T09:27:52Z")

</div>

[quote=Macsy;2326473]everywere you have  
po\_x  
and po\_y  
did you forget it should be ‘.’ ?  
po.\_x

etc[/quote]

Lol, a common mistake that everyone makes.

---

<div class="post-metadata">

**Author:** ![Macsy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/macsy/32/3238_2.png) [@Macsy](https://forum.kirupa.com/u/Macsy)\
**Post date:** [May 15, 2008, 11:40am UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/4 "2008-05-15T11:40:42Z")

</div>

> [@Jephz;2326521](#):
>
> Lol, a common mistake that everyone makes.

EDIT:  
Ive never done such a misstake.  
or at least ive never had to turn to a forum to get help for it =)

---

<div class="post-metadata">

**Author:** ![Leo75](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@Leo75](https://forum.kirupa.com/u/Leo75)\
**Post date:** [May 15, 2008, 2:55pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/5 "2008-05-15T14:55:18Z")

</div>

To Macsy and Jephz: without so much love…

if you guys pay a little more attention, po\_y and po\_x are variables that receive values at the begining of the code, therefore NO need to place a DOT like one of you suggested and the other one embraced.

```auto

po_x=-101.5; //VARIABLE!!!!
po_y=-1109.1; //VARIABLE!!!!

t=1;
 for (c = 1; c < 30; c++) 
   {
    _root.mc_l_1["area_test_" + c]._x = po_x; // HERE is the position x for mc_l_1
    _root.mc_l_1["area_test_" + c]._y = po_y; // HERE is the position y for mc_l_1
    po_y=po_y+ 102;
  if(t==19)...

```

[COLOR=black][FONT=Verdana]So, instead of bragging about each others amazing and most infinite skills in programming, what about actually helping me on duplicating one movie clip inside of another one, instead of using the forum to showoff and actually using it as it is supposed to b used: to help.[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]Thanks.[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana][/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]Leo.[/FONT][/COLOR]

---

<div class="post-metadata">

**Author:** ![JBPresents](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JBPresents](https://forum.kirupa.com/u/JBPresents)\
**Post date:** [May 15, 2008, 6:18pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/6 "2008-05-15T18:18:35Z")

</div>

when you rename the new movieclip you just input a name  
for (i = 1; i \< 30; i++)  
{  
duplicateMovieClip(_root.mc\_l\_1[“area\_test”],"area\_test_" + i, \_root.mc\_l\_1.getNextHighestDepth());  
}  
po\_x=-101.5;  
po\_y=-1109.1;  
t=1;  
for (c = 1; c \< 30; c++)  
{  
_root.mc\_l\_1["area\_test_" + c].\_x = po\_x;  
_root.mc\_l\_1["area\_test_" + c].\_y = po\_y;  
po\_y+= 102;  
if(t==19)  
{  
t=0;  
po\_x += 120;  
po\_y = -1109.1;  
}  
t++;  
}

---

<div class="post-metadata">

**Author:** ![JBPresents](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JBPresents](https://forum.kirupa.com/u/JBPresents)\
**Post date:** [May 15, 2008, 6:25pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/7 "2008-05-15T18:25:48Z")

</div>

what i would really do is simply make a call to the linked library item and initalize it such as

\_root.createEmptyMovieClip(“emp”,-1);

poX = 101.5  
poY = -1109.1;

for(i=0;i\<30;i++){  
_root.emp.attachMovie(“area\_test”,"area\_test_"+i,\_root.emp.getNextHighestDepth());  
tempMC = _root.emp["area\_test_"+i];  
tempMC.\_x = poX;  
tempMC.\_y = poY;  
poY+=102;  
if(i==19){  
poX+=120;  
poY = -1109.1;  
}  
}

just make sure you have the item checked to be exported in first frame, and call your library item in the action script linkage box “area\_test” and this code should take care of the rest (I hope untested just wrote it)

---

<div class="post-metadata">

**Author:** ![Leo75](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@Leo75](https://forum.kirupa.com/u/Leo75)\
**Post date:** [May 15, 2008, 6:30pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/8 "2008-05-15T18:30:11Z")

</div>

Hey! Thanks a lot!  
It worked!

Cheers!  
And again, thanks for the reply!  
Leo.

---

<div class="post-metadata">

**Author:** ![JBPresents](https://avatars.discourse-cdn.com/v4/letter/j/bc79bd/32.png) [@JBPresents](https://forum.kirupa.com/u/JBPresents)\
**Post date:** [May 15, 2008, 6:42pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-problemo-help-pls/260358/9 "2008-05-15T18:42:19Z")

</div>

no worries
