Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Working with Movie Clips > Creating movie clips at runtime > Duplicating or removing a movie clip | |||
To duplicate or remove movie clip instances, use the duplicateMovieClip() or removeMovieClip() global functions, or the MovieClip class methods of the same name. The duplicateMovieClip() method creates a new instance of an existing movie clip instance, assigns it a new instance name, and gives it a depth, or z-order. A duplicated movie clip always starts at Frame 1, even if the original movie clip was on another frame when duplicated and is always in front of all previously defined movie clips placed on the timeline.
To delete a movie clip you created with duplicateMovieClip(), use removeMovieClip(). Duplicated movie clips are also removed if the parent movie clip is deleted.
For more information, see duplicateMovieClip function and removeMovieClip function in the ActionScript 2.0 Language Reference.
For a sample source file, animation.fla, that creates and removes numerous movie clips at runtime, see the Flash Samples page at www.adobe.com/go/learn_fl_samples. Download and decompress the Samples zip file and navigate to the ActionScript2.0/Animation folder to access the sample.
|
|
|
|