MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 531

Actionscript language reference
Table of Contents

Advertisement

duplicateMovieClip()
Availability
Flash Player 4.
Usage
duplicateMovieClip(target:String, newname:String, depth:Number) : Void
Parameters
The target path of the movie clip to duplicate.
target
A unique identifier for the duplicated movie clip.
newname
A unique depth level for the duplicated movie clip. The depth level is a stacking order for
depth
duplicated movie clips. This stacking order is similar to 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
SWF files on occupied depths.
Returns
Nothing
Description
Function; creates an instance of a movie clip while the SWF file is playing. The playhead in
duplicate movie clips always starts at Frame 1, regardless of where the playhead is in the original
movie clip. Variables in the original movie clip are not copied into the duplicate movie clip. Use
the
removeMovieClip()
duplicateMovieClip()
Example
In the following example, a new movie clip instance is created called
into the movie clip, and then the
, and this new clip is moved on the Stage so it does not overlap the original clip, and
newImg_mc
the same image is loaded into the second clip.
this.createEmptyMovieClip("img_mc", this.getNextHighestDepth());
img_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/
112x112/box_studio_112x112.jpg");
duplicateMovieClip(img_mc, "newImg_mc", this.getNextHighestDepth());
newImg_mc._x = 200;
newImg_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/
112x112/box_studio_112x112.jpg");
To remove the duplicate movie clip, you could add this code for a button called
this.myButton_btn.onRelease = function(){
removeMovieClip(newImg_mc);
};
See also
MovieClip.duplicateMovieClip(), removeMovieClip(),
function or method to delete a movie clip instance created with
.
clip is duplicated. The duplicated clip is called
img_mc
CHAPTER 7
ActionScript for Flash
An image is loaded
img_mc.
myButton_btn
MovieClip.removeMovieClip()
duplicateMovieClip()
.
531

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents