View comments | RSS feed

unloadMovie()

Availability

Flash Player 3.

Usage

unloadMovie(target:MovieClip) : Void
unloadMovie(target:String) : Void

Parameters

target The target path of a movie clip.

Returns

None.

Description

Function; removes a movie clip that was loaded by means of loadMovie() from Flash Player. To unload a movie clip that was loaded by means of loadMovieNum(), use unloadMovieNum() instead of unloadMovie().

Example

The following example creates a new movie clip called pic_mc and loads an image into that clip. It is loaded using the MovieClipLoader class. When you click the image, the movie clip unloads from the SWF file:

var pic_mcl:MovieClipLoader = new MovieClipLoader();
pic_mcl.loadClip("http://www.macromedia.com/devnet/blueprint/articles/performance/spotlight_speterson.jpg", this.createEmptyMovieClip("pic_mc", this.getNextHighestDepth()));
var listenerObject:Object = new Object();
listenerObject.onLoadInit = function(target_mc) {
   target_mc.onRelease = function() {
      unloadMovie(pic_mc);
      /* or you could use the following, which refers to the movie clip referenced by 'target_mc'. */
      //unloadMovie(this);
   };
};
pic_mcl.addListener(listenerObject);

See also

MovieClip.loadMovie(), MovieClipLoader.unloadClip()

Comments


Krxtopher said on Sep 20, 2004 at 10:24 AM :
The unloadMovie() method also works for MovieClips that were simply placed in the Timeline during authoring.

 

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/00001868.html