-
duplicate movie clips for multiple MC's
I need to duplicate several MC's (each one x 20) when he movie is loaded.
I can't get it to work for the life of me....
Any ideas?
Thanks
~fit
this code resides in _root.MC and the first frame
================================================== ==
count = 0;
function dup1() {
while (count<20) {
circle.duplicateMovieClip("circle"+count, count);
count++;
}
}
count2 = 0;
function dup2() {
while (count2<20) {
circle2.duplicateMovieClip("circle2"+count2, count2);
count2++;
}
}
dup1();
dup2();
================================================== =
Only duplicates the circle2. If I don't initiate the 2nd func (dup2();...it works for circle...and visa/versa?????????
Can you NOT do duplicate movies for multiple MC's??
-
Senior Member
The problem is the depth of the movies you are duplicating (the 2nd parameter).
You can only have one movieclip at a particular depth. If you try to put a second movieclip at the same depth, it obliterates the first one. To fix, in your dup2 code, change this line:
circle2.duplicateMovieClip("circle2"+count2, count2);
to this:
circle2.duplicateMovieClip("circle2"+count2, count2 + 20);
so the second set of movies go to unique depths.
It's also worth mentioning that you could use a single function that accepts parameters, and reduce the amount of code by half.
For example:
code:
function myDupe(mc, nameRoot, minDepth)
{
for (count = 0; count < 20; ++count)
{
mc.duplicateMovieClip(nameRoot+count, minDepth+count);
}
}
myDupe(circle, "circle", 0);
myDupe(circle2, "circle2", 20);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|