View Full Version : use of "duplicateMovieClip"
morphius3263
10-28-2001, 08:35 PM
I'm very new to actionscript (i only started using it a few days ago), and I've been looking at the tutorials. I can't seem to figure out how to use the duplicateMovieClip command effectively.
Here is some script from the tutorial.
on (release) {
count = 1;
while (count<20) {
_root.box.duplicateMovieClip("boxx"+count, count);
count += 1;
}
}
Could somebody plleeeeease go through this with me, line by line?
Thanks.
:(
Billy T
10-28-2001, 11:59 PM
I'm no expert but I'll try to help
on (release) {when you click the button
count = 1; a variable used to simplify the naming of the duplicates and the level they are loaded into etc
while (count<20) { this stops flash from produce an infinate number of duplicates
_root.box.duplicateMovieClipthe instance to be duplicated ("boxx"+countthe instance name of the duplicate - ie the first time it goes through the duplicate will be called "boxx"+1 , countthe level that the duplicate is loaded into - if there is something already in this level then it will be removed );
count += 1; updates the variable so the next time it runs it will = 2
}
}
I hope this helps a little. You can get some cool effects but putting in some random settings to apply to the new duplicate. ie
on (release) {
count = 1;
while (count<20) {
_root.box.duplicateMovieClip("boxx"+count, count);
setProperty ("boxx"+ count, _x, random(505));
setProperty ("boxx"+ count, _y, random(505));
setProperty ("boxx"+ count, _xscale, random(150));
setProperty ("boxx"+ count, _yscale, random(150));
setProperty ("boxx"+ count, _rotation, random(360));
setProperty ("boxx"+ count, _alpha, random(100));
count += 1;
}
}
You would want to make sure you use a "remove movie clip" action as well. Use something like this
count = 1;
while (count <20) {
removeMovieClip ("boxx"+count);
count = count +1;
}
cheers
morphius3263
10-29-2001, 04:29 PM
Thanks a lot for that, it's a great help. :D
Billy T
10-29-2001, 09:42 PM
welcome:p
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.