I was wondering what you put in for addressing the duplicate MC???
PLZ tell me.
Thx
well, depending where you place the duplicate, you would usually call it by the name you gave it:
[color=blue]duplicateMovieClip[/color](“dis”, “dat”, 1);
you could usually access the movie directly like:
dat.[color=blue]_x[/color] = [COLOR=blue]random/COLOR;
or something.
there’s a different story when you’re duplicating multiple times like so:
for (i = 0; i < 20; ++i) {
duplicateMovieClip(“dis”, “dat”+i, i);
}
the problem here is that you might want to access each of the duplicate but don’t want to go through the process of calling each one by it’s name (eg: dat0._x =… dat1._x =… and so on). what you could do is access the duplicate within the loop as soon as it’s made. this way, you don’t have to write scripts for each of the duplicates. for example:
for (i = 0; i < 20; ++i) {
duplicateMovieClip(“dis”, “dat”+i, i);
mc = _parent[“dat”+i];
mc._x = random(550);
mc._y = random(400);
}
as you can see, i assigned a variable the name of the duplicate that was just made through the line:
mc = _parent[“dat”+i];
now you can control the duplicate however you like using “mc” as if that were the duplicate.
hope this helped.
Thank you.
In MX, duplicateMovieClip returns a reference to the clip, so you could just do mc=duplicateMovieClip(…);
be aware duplicateMovieClip needs to be in the form mc.duplicateMovieClip(…) for a return value and not duplicateMovieClip(mc, …)
also bear in mind attachMovie also returns a mc reference when called as does createEmptyMovieClip
Is mc the instance name??
yeah, of the movieclip you want to duplicate
look it up in flash help for more info
look in the actionscript dictionary under M for movieclip then MovieClip.duplicateMovieClip
k, thx for all the help.
just wait, for when you put duplicate the movie they ask for the target, newname, depth.
i dont know what to put in those.
There’s a tute about duplicate movie clip, but it uses the old syntax.
ok