De-I > duplicateMovieClip
duplicateMovieClipSyntax
duplicateMovieClip(
target
,
newname
,
depth
);
Arguments
target
The target path of the movie to duplicate.
newname
A unique identifier for the duplicate movie clip.
depth
The depth level of the movie clip. The depth level is the stacking order that determines how movie clips and other objects appear when they overlap. The first movie clip that your create, or instance that you drag onto the Stage, is assigned a depth of level 0. You must assign each successive or duplicated movie clip a different depth level to prevent it from replacing movies on occupied levels or the original movie clip.
Description
Action; creates an instance of a movie clip while the movie is playing. Duplicate movie clips always start at frame 1, no matter what frame the original movie clip was on. Variables in the parent movie clip are not copied into the duplicate movie clip. If the parent movie clip is deleted the duplicate movie clip is also deleted. Use the removeMovieClip
action or method to delete a movie clip instance created with duplicateMovieClip
.
Player
Flash 4 or later.
Example
This statement duplicates the movie clip instance flower
ten times. The variable i
is used to create a new instance name and a depth.
on(release) { amount = 10; while(amount>0) { duplicateMovieClip (_root.flower, "mc" + i, i); setProperty("mc" + i, _x, random(275)); setProperty("mc" + i, _y, random(275)); setProperty("mc" + i, _alpha, random(275)); setProperty("mc" + i, _xscale, random(50)); setProperty("mc" + i, _yscale, random(50)); i = i + 1; amount = amount-1; } }
See also
removeMovieClip
MovieClip.removeMovieClip