View comments | RSS feed

removeMovieClip function

removeMovieClip(target:Object)

Deletes the specified movie clip.

Availability: ActionScript 1.0; Flash Player 4

Parameters

target:Object - The target path of a movie clip instance created with duplicateMovieClip() or the instance name of a movie clip created with MovieClip.attachMovie(), MovieClip.duplicateMovieClip(), or MovieClip.createEmptyMovieClip().

Example

The following example creates a new movie clip called myClip_mc and duplicates the movie clip. The second movie clip is called newClip_mc. Images are loaded into both movie clips. When a button, button_mc, is clicked, the duplicated movie clip is removed from the Stage.

this.createEmptyMovieClip("myClip_mc", this.getNextHighestDepth());
myClip_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
duplicateMovieClip(this.myClip_mc, "newClip_mc", this.getNextHighestDepth());
newClip_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
newClip_mc._x = 200;
this.button_mc.onRelease = function() {
 removeMovieClip(this._parent.newClip_mc);
};

See also

duplicateMovieClip function, duplicateMovieClip (MovieClip.duplicateMovieClip method), attachMovie (MovieClip.attachMovie method), removeMovieClip (MovieClip.removeMovieClip method), createEmptyMovieClip (MovieClip.createEmptyMovieClip method)


Version 8

Comments


neil8010 said on Dec 24, 2006 at 9:18 AM :
Bug: removeMovieClip function does not work when a button component is in the library. If the code below is pasted into frame 1 of a new flash document everything is fine (only one image is displayed). However if a button component is added to the library, removeMovieClip function fails and two images are shown. If the button component is deleted from the library it works again.

this.createEmptyMovieClip("myClip_mc", this.getNextHighestDepth());
myClip_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
duplicateMovieClip(this.myClip_mc, "newClip_mc", this.getNextHighestDepth());
newClip_mc.loadMovie("http://www.helpexamples.com/flash/images/image1.jpg");
newClip_mc._x = 200;
removeMovieClip(myClip_mc);
Snottlebocket said on Mar 5, 2007 at 11:38 PM :
This function can malfunction when used in combination with (standard macromedia) components.

I made a small application that uses some of the standard macromedia components (combobox) as well as dynamically placed movieclips. For the most part this combination caused no problems, except when trying to apply removeMovieClip( ) on some of the dynamically placed movieclips.

This issue is somehow related to the depths components use for themselfs, and is easily fixed by using swapDepths to place your own movieclip on a proper depth before removing it.

Example:

/*this might malfunction in combination with components*/
removeMovieClip(my_mc);

/*this should circumvent the issue*/
my_mc.swapDepths(5000);
removeMovieClip(my_mc);
scibert said on Jun 11, 2007 at 10:39 PM :
Fortunately, this bug no longer exists when publishing to Flash Player 9.

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flash/8/main/00001765.html