Accessibility
 
Home > Products > Flash > Support > ActionScript Dictionary
Flash Icon Macromedia Flash Support Center - ActionScript dictionary
duplicateMovieClip

Availability
Flash Player 4.

Usage

 duplicateMovieClip(  target  ,   newname  ,   depth  ) 

Parameters
target The target path of the movie clip to duplicate.

newname A unique identifier for the duplicated movie clip.

depth A unique depth level for the duplicated movie clip. The depth level is a stacking order for duplicated movie clips. This stacking order is much like the stacking order of layers in the Timeline; movie clips with a lower depth level are hidden under clips with a higher stacking order. You must assign each duplicated movie clip a unique depth level to prevent it from replacing movies on occupied depths.

Returns
Nothing.

Description
Action; creates an instance of a movie clip while the movie is playing. The playhead in duplicate movie clips always starts at Frame 1, regardless of where the playhead is in the original (or "parent") movie clip. 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 .

Example
This statement duplicates the movie clip instance flower ten times. The variable i is used to create a new instance name and a unique depth for each duplicated movie clip.

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++;
		amount--;
	}
}

See also
MovieClip.duplicateMovieClip , removeMovieClip , MovieClip.removeMovieClip

To Table of Contents Back to Previous document Forward to next document