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:
onClipEvent (load) {
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
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
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.
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?
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.