Name

MovieClip.duplicateMovieClip( ) Method — create a copy of a movie clip

Availability

Method form introduced in Flash 5 (global form introduced in Flash 4)

Synopsis

mc.duplicateMovieClip(newName, depth)

Arguments

newName

A string that will become the instance name of the duplicated clip. The name must adhere to the rules for creating an identifier outlined under Section 14.5 in Chapter 14.

depth

An integer specifying the level on which to place the new clip in the programmatically generated clip stack above mc. A depth of -1 is below 0, 1 is in front of 0, 2 is in front of 1, and so on. See Section 13.4.2.2 in Chapter 13 for more details. Negative depths are functional but not officially supported by ActionScript; to ensure future compatibility, use depths of or greater.

Description

The MovieClip.duplicateMovieClip( ) method is an alternative to the global duplicateMovieClip( ) function. When invoked as a MovieClip method, duplicateMovieClip( ) takes no target parameter—it duplicates mc. The method syntax is less prone to user error than its global function counterpart.

For usage instructions, see the global duplicateMovieClip( ) function.

See Also

MovieClip.attachMovie( ), duplicateMovieClip( )

Get ActionScript: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.