Duplicate MC

amount = 10;
while (amount>0) {
duplicateMovieClip(_root.abc, “mc”+i, i);
setProperty(“mc”+i, _x, i);
i++;
amount–;
}

how can I set the property of duplicated Mc’s that the distance betwen Mc’s to be 10 px?
help…thanks

Tip 1: Use an ID for the duplicated clip. [AS]mc = duplicateMovieClip(_root.abc, “mc”+i, i);[/AS] See why in Tip 2.

Tip 2: Don’t use setProperty, dot syntax came in with Flash 5 [AS]mc._x = i*10;[/AS]

If you didn’t give your duplicated clip and ID you would have to type that out as [AS]this[“mc”+i]._x = i*10;[/AS] and that can get quite annoying when targeting the duplicated clip for more than one property change (_x, _y, _alpha, _rotation, etc)

ah it’s so simple…and logical!
it’s seams that I don,t think too much

You’d be surprised how easily the obvious escapes us. The first time I ever had to do something simliar it took me like an hour to figure out the i*spacing formula.

This method will of course start your clips at _x:0 though. If you wanted your clips to start duplicating at say _x:100 you could use [AS]mc._x = 100+(i*10);[/AS]

Oh yeah, and just as an alternative way of writing duplicateMovieClip() (personal preference really, they both do the exact same thing) you can write [AS]mc = _root.abc.duplicateMovieClip(“mc”+i, i);[/AS]

I’m on a roll :wink:

thanks a lot…roll-inbeta!

Ok ok, 1 more [AS]mc = _root.abc.duplicateMovieClip(“mc”+i, i, {_x:i*10});[/AS] That does everything you want all in 1 line. But that’s more advanced (of course), it uses the initObject to modify the properties of the clip upon creation of the clip. Or something like that.

Ok, i’m done. Have fun!

Show Off

:wink: