
removeMovieClip() Global Function
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
744
|
ActionScript Language Reference
removeMovieClip() Global Function
delete a movie clip from the Flash Player
Flash 4
removeMovieClip(target)
Arguments
target A string or reference indicating the path to the movie clip instance to be
removed from the Player (references to movie clips are converted to paths
when used in a string context).
Description
The removeMovieClip() function deletes the specified movie clip from the Player, leaving
no trace of the clip’s contents or shell. Subsequent references to the clip or any variables or
properties it contained yield
undefined.
The removeMovieClip() function can be used only on movie clip instances that were origi-
nally created via duplicateMovieClip(), attachMovie(),orcreateEmptyMovieClip(). It has no
effect on movie clips on negative depths (normally those created at authoring time). To
remove a negative-depth clip, first swap it to a positive depth, then remove it:
theClip_mc.swapDepths(1234); // Pick a safe number to swap to.
theClip_mc.removeMovieClip(); // Remove the clip.
If more than one variable refers to the same movie clip, removeMovieClip() deletes the
movie clip from the Stage but other references to it remain. That is, the movie clip persists
as a data object until all references to the clip have ...