# Duplicate and set \_x

**URL:** <https://forum.kirupa.com/t/duplicate-and-set--x/45876>\
**Category:** flash\
**Created:** [March 18, 2004, 9:14pm UTC](https://forum.kirupa.com/t/duplicate-and-set--x/45876 "2004-03-18T21:14:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashSwimmer](https://avatars.discourse-cdn.com/v4/letter/f/35a633/32.png) [@FlashSwimmer](https://forum.kirupa.com/u/FlashSwimmer)\
**Post date:** [March 18, 2004, 9:14pm UTC](https://forum.kirupa.com/t/duplicate-and-set--x/45876/1 "2004-03-18T21:14:53Z")

</div>

Hi guys… 😃  
i’m trying to duplicate MovieClip in the root to make something like Nav. so i tried and searched a lot of times but i couldn’t find anything helped me…  
i want to duplicate and set every new clips his own \_x and make it clickable :puzzle: .  
here is my code and i think it’s very easy but i can’t figer it ☹  
[AS]function duplication(trt) {  
this.trt = trt;  
for (i=0; i\<=trt; i++) {  
duplicateMovieClip(“test”, “test”+i, i);  
\_root[“test”+i].\_x = \_root[“test”+i].\_x+60;  
}  
}  
\_root.onEnterFrame = function() {  
duplication(10);  
};[/AS]  
thanx

---

<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:** [July 23, 2004, 2:26pm UTC](https://forum.kirupa.com/t/duplicate-and-set--x/45876/2 "2004-07-23T14:26:06Z")

</div>

hello,

the previous comments were very helpful to me. I have gotten pretty far with my movie. Basically, my intent is to pull images from a remote folder and create thumbnails which will then be enlarged. I have one issue. I need to be able to claim a maximum number of images rather than claiming a total number of columns and rows. I still need the columns and rows but I want to duplicate the movies within the columns and rows for the total number of images I have.

Here is the code I have currently. It duplicates the outside images based on the column and row total.

[AS]  
COLS = 14; // number of columns in grid  
ROWS = 2; // number of rows in grid  
vSPACING = 40; // spacing between circles in pixels  
hSPACING = 23; // spacing between circles in pixels  
LEFTMARGIN = 85;  
TOPMARGIN = 310;  
DEPTH = 0; // starting point for depth  
count = 0;  
for (i=1; i\<=ROWS; i++) {  
for (k=1; k\<=COLS; k++) {  
thumb = this.createEmptyMovieClip(“btn\_mc”+i+"\_"+k, DEPTH++);  
thumb.\_x = LEFTMARGIN + ((k-1) \* (vSPACING + thumb._width));  
thumb.y = TOPMARGIN + ((i-1) \* (hSPACING + thumb.height));  
this[“btn\_mc”+i+""+k].a = i+""+k;  
this.a = this\_a;  
this[“btn\_mc”+i+"_"+k].i = DEPTH;  
this.thumb.createEmptyMovieClip(“imgHolder\_mc”, 1);  
this.thumb.\_xscale = 5;  
this.thumb.\_yscale = 5;  
this.thumb.onRelease = function (){  
container.loadMovie(“slide/number” + this.i + “.jpg”);  
container.\_x = 100;  
container.\_y = 8;  
container.\_xscale = 70;  
container.\_yscale = 70;  
this.\_alpha = 35;

}  
this.thumb.imgHolder\_mc.loadMovie(“slide/number” + DEPTH + “.jpg”);  
}  
}  
//create a movie clip to hold the larger images  
\_root.createEmptyMovieClip(“container”, DEPTH+2);  
container.loadMovie(“slide/number1.jpg”);  
container.\_x = 100;  
container.\_y = 8;  
container.\_xscale = 70;  
container.\_yscale = 70;  
[/AS]
