To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here


A Flash Developer Resource Site

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Reply
 
Thread Tools Search this Thread Display Modes
Old 10-19-2004, 02:10 AM   #1
fitchic77
Senior Member
 
Join Date: Jul 2001
Posts: 198
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??
fitchic77 is offline   Reply With Quote
Old 10-19-2004, 03:03 AM   #2
jbum
Senior Member
 
jbum's Avatar
 
Join Date: Feb 2004
Location: Los Angeles
Posts: 2,920
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);

__________________
jbum is offline   Reply With Quote
Reply

Go Back   Flash Kit Community Forums > Flash Help > Flash ActionScript

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:24 PM.


internet.commerce
Be a Commerce Partner
 »  »  »  »  »  »  »
 »  »  »  »  »  »
 

    

Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.