View comments | RSS feed

MovieClip.unloadMovie()

Availability

Flash Player 5.

Usage

my_mc.unloadMovie() : Void

Parameters

None.

Returns

Nothing.

Description

Method; removes the contents of a movie clip instance. The instance properties and clip handlers remain.

To remove the instance, including its properties and clip handlers, use MovieClip.removeMovieClip().

You can extend the methods and event handlers of the MovieClip class by creating a subclass. For more information, see "Assigning a class to a movie clip symbol" in Using ActionScript in Flash.

Example

The following example unloads a movie clip instance called image_mc when a user clicks the unloadMC_btn instance.

this.createEmptyMovieClip("image_mc", 1);
image_mc.loadMovie("http://www.macromedia.com/images/shared/product_boxes/112x112/box_studio_112x112.jpg");
unloadMC_btn.onRelease = function() {
   image_mc.unloadMovie();
};

See also

MovieClip.attachMovie(), MovieClip.loadMovie(), unloadMovie(), unloadMovieNum()

Comments


michaelbarsotti said on Jul 27, 2004 at 8:49 PM :
I think this might be incorrect. As seen in example code below, the movieClip is not undefined until I call removeMovieClip()

trace("mcCreated? " + mcCreated);
createEmptyMovieClip("mcCreated", 1);
trace("mcCreated? " + mcCreated);
mcCreated.unloadMovie();
trace("mcCreated? " + mcCreated);
mcCreated.removeMovieClip();
trace("mcCreated? " + mcCreated);
stop();
jepo said on Jul 29, 2004 at 1:47 PM :
unloadMovie unloads content loaded with loadMovie (see http://livedocs.macromedia.com/flash/mx2004/main_7_2/wwhelp/wwhimpl/js/html/wwhelp.htm?href=00001563.html for details about loadMovie).
No screen name said on Jul 29, 2004 at 2:55 PM :
right, but the example given in the help file above says to use unloadMovie() to remove a movieClip created with createEmptyMovieClip. If you run this example it doesn't unload the movieClip but it does unload the <i>contents</i> of the movieClip. I guess I was thinking that unloading the movie meant removing it from existance.

Thanks for clearing this up for me.

 

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

Current page: http://livedocs.adobe.com/flash/mx2004/main_7_2/00001563.html