# Simple For Loop to Duplicate a Movie Clip

Hi,
I’d like to duplicate a move clips say 100 times. I know I need to set i = 0 to begin & then have a for loop

For example:

i = 0
for (i <101) {
duplicateMovieClip, dup + i, i)
i = i++
}
}
Basically I know its something like this I just need a little help with the syntax. Thank you much. I appreciate it.
Tim

for(ii=0;ii<=100;ii++){
dulicateMovieClip(“dup”, “copy”+ii, ii)
}

I believe the syntax is explained in the help, you know. Basically, as Jubby wrote, for loops are build so :
for (variable ; ending condition ; increment) {}
and i = i++ doesn’t make any sense, because i++ means i=i+1.
So that would mean i=i=i+1

pom 0]

sorry i was in a hurry., I was going to explain it!

Just for the record, your syntax was closer to a while loop :

`````` while (i<101) {
duplicate... ;
i++ ;
}
``````

pom 0]

Just for the record:

SHHHHHHHHHHHHHHHHHHH!!!

Hey, sorry, but I feel like posting tonight. Yeah baby yeah !!

pom 0]

I feel like posting too…trying to increase my number of total posts here…My girlfriend is watching me calling me a dork because I’m conversing with you all thru this board…she just doen’st understand me…

Well, yes, I guess it’s hard to understand. What can I say to you, Jubby’s g/f ? Peut-être que Flash est extrêment prenant, et qu’une fois que tu as commencé, tu as un besoin irresistible d’en parler avec le plus de gens possibles.
There, I hope you understand now.

pom 0]

she said, “pffft!” Then admitted that she was a dork too, so its alright.

You’ll have to give me the exact meaning of dork some day (I only heard it once in Pulp Fiction :rolleyes: )
pom 0]

dork Pronunciation Key (dôrk) n.

Slang. A stupid, inept, or foolish person: “the stupid antics of America’s favorite teen-age cartoon dorks” (Joshua Mooney).

Vulgar Slang. The penis.

Hi, Thanks for the education. I appreciate it.
POM pointed out I was closer to a dowhile. I know there must be so please elighten me. What’s the difference between the two? Basically you can use one or the other in just about any sitation, right?

Thanks again,
Tim

PS - You guys are really post whores tonight. lol

I’m just a whore.

They are both loops, there are just certain instances where one is more favorable than the other.

Jubba, can you give me examples for both?
If you girlfriend doesn’t kill ya for rotting on that computer.

All loops can be used to do the same thing. There is no fundamental difference, but some of them apply more easily to certain circumstances.

For instance, if you want to duplicate 200 times a movie clip (you KNOW how many you want), you’ll use a for loop :

`````` for (i=1;i<=200;i++) {
name = "copy"+i ;
_root.mc.duplicateMovieClip ("my_Clip",name,i) ;
}
``````

If you want to fill your screen until your clips reach a certain _x position, you’ll use a while loop :

`````` while (x<200) {
x+=5 ;
name = "copy"+i ;
_root.mc.duplicateMovieClip ("my_Clip",name,i) ;
this[name]._x = x ;
}
``````

Or you can use do … while (), which is basically the same, except that the test is made at the end of the loop. The code between {} will be executed at least once, contrary to the while loop.

pom 0]

So while loops are usually used when you don’t know how many times you want to iterate.
pom 0]

Pom, Thank you very much. Extremly well explained.
Tim