03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Creates an instance of a movie clip while the SWF file is playing. The playhead in duplicate<br />

movie clips always starts at Frame 1, regardless of where the playhead is in the original movie<br />

clip. Variables in the original movie clip are not copied into the duplicate movie clip. Use the<br />

removeMovieClip() function or method to delete a movie clip instance created with<br />

duplicateMovieClip().<br />

Parameters<br />

target:Object - The target path of the movie clip to duplicate. This parameter can be either<br />

a String (e.g. "my_mc") or a direct reference to the movie clip instance (e.g. my_mc).<br />

Parameters that can accept more than one data type are listed as type Object.<br />

newname:String - A unique identifier for the duplicated movie clip.<br />

depth:Number - A unique depth level for the duplicated movie clip. The depth level is a<br />

stacking order for duplicated movie clips. This stacking order is similar to the stacking order<br />

of layers in the Timeline; movie clips with a lower depth level are hidden under clips with a<br />

higher stacking order. You must assign each duplicated movie clip a unique depth level to<br />

prevent it from replacing SWF files on occupied depths.<br />

Example<br />

In the following example, a new movie clip instance is created called img_mc. An image is<br />

loaded into the movie clip, <strong>and</strong> then the img_mc clip is duplicated. The duplicated clip is<br />

called newImg_mc, <strong>and</strong> this new clip is moved on the Stage so it does not overlap the original<br />

clip, <strong>and</strong> the same image is loaded into the second clip.<br />

this.createEmptyMovieClip("img_mc", this.getNextHighestDepth());<br />

img_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");<br />

duplicateMovieClip(img_mc, "newImg_mc", this.getNextHighestDepth());<br />

newImg_mc._x = 200;<br />

newImg_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");<br />

To remove the duplicate movie clip, you could add this code for a button called<br />

myButton_btn.<br />

this.myButton_btn.onRelease = function(){<br />

removeMovieClip(newImg_mc);<br />

};<br />

See also<br />

removeMovieClip function, duplicateMovieClip (MovieClip.duplicateMovieClip<br />

method), removeMovieClip (MovieClip.removeMovieClip method)<br />

Global Functions 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!