# Cant duplicate two movies in a for statement?

**URL:** <https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394>\
**Category:** Uncategorized\
**Created:** [November 13, 2003, 1:22pm UTC](https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394 "2003-11-13T13:22:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yakob](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/yakob/32/348_2.png) [@yakob](https://forum.kirupa.com/u/yakob)\
**Post date:** [November 13, 2003, 1:22pm UTC](https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394/1 "2003-11-13T13:22:27Z")

</div>

hi out there,

been following a great tutorial for grid creation at:

[http://www.kirupa.com/developer/actionscript/grid.htm](http://www.kirupa.com/developer/actionscript/grid.htm)

i’m trying to adapt this to work with two moviclips (a horizontal line and a verticle) to great a grid that ‘fades’ in. to do this, i’ve basically taken the original and added a 2nd MC referance:

gridx=30;  
gridy=30;  
num=0;  
for (var i=0;i \< 10;i++)  
{  
for (var j=0;j \< 10;j++)  
{  
vert.duplicateMovieClip(“vert”+num,num);  
vertMc=this[“vert”+num];  
vertMc.\_x=gridx_i;  
hori.duplicateMovieClip(“hori”+num,num);  
horiMc=this[“hori”+num];  
horiMc.\_y=gridy_j;  
num++;  
}  
}  
vert.\_visible=0;  
hori.\_visible=0;

but no jpy! i get ‘some’ of the horizontal lines but no verticals at all.

in addition to this i need to make the grid 210 x 510. the moment i increase the \< 10 above 20, the whole script grinds to a halt and brings the flash player to it’s knees!

i’ve posted the fla here:

[http://www.28design.co.uk/jake/flash/duplicate\_grid\_v2.fla](http://www.28design.co.uk/jake/flash/duplicate_grid_v2.fla)

if anyone can help, it would be grand!

many thanks,

jake

---

<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:** [November 13, 2003, 2:14pm UTC](https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394/2 "2003-11-13T14:14:49Z")

</div>

try this:

[AS]gridx = 10;  
gridy = 10;  
num = 0;  
nr = 1;  
for (var i = 0; i\<15; i++) {  
hori.duplicateMovieClip(“hori”+num, num);  
horiMc = this[“hori”+num];  
horiMc.\_y = gridy_i;  
num = num+2;  
}  
for (var j = 0; j\<10; j++) {  
vert.duplicateMovieClip(“vert”+nr, nr);  
vertMc = this[“vert”+nr];  
vertMc.\_x = gridx_j;  
nr = nr+2;  
}  
vert.\_visible = 0;  
hori.\_visible = 0;[/AS]

scotty;)

---

<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:** [November 13, 2003, 2:29pm UTC](https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394/3 "2003-11-13T14:29:24Z")

</div>

hi scotty,

that (in the words of dj shadow) is the money!

thanks for taking the time to look, really appricate it.

cheers,

jake

---

<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:** [November 13, 2003, 2:31pm UTC](https://forum.kirupa.com/t/cant-duplicate-two-movies-in-a-for-statement/35394/4 "2003-11-13T14:31:57Z")

</div>

no problem:thumb:
