Name

duplicateMovieClip( ) Global Function — create a copy of a movie clip

Availability

Flash 4 and later

Synopsis

duplicateMovieClip(target, newName, depth)

Arguments

target

A string indicating the path to the movie clip to duplicate (known as the seed clip ). Nested clips may be referred to with dot syntax, as in duplicateMovieClip(“_root.myClip”, “myClip2”, 0). Because a movie clip reference is converted to a path when used in a string context, target may also be a movie clip object reference, as in duplicateMovieClip(myClip, “myClip2”, 0).

newName

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

depth

An integer indicating the level in the programmatic clip stack on which to place the duplicated clip. Clips on lower levels are placed visually behind clips on higher levels. The movie clip with the highest depth in a stack obscures all the clips below it. For example, a clip on depth -1 appears behind a clip on depth 0, which appears behind a clip on depth 1. If the assigned depth is occupied, the occupant clip is removed, and the new duplicate takes its place. See Chapter 13 for additional details. Negative depths are functional, but not officially supported by ActionScript; to ensure future compatibility, use depths of or greater.

Description

The duplicateMovieClip( ) function is one way to create a new movie clip during movie playback (the other is attachMovie( ...

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.