Table of Contents

unloadMovie( ) Global Function Flash 4

unload a movie or movie clip from the Player
unloadMovie(target)

Arguments

target

A string or reference indicating the path to the movie clip or document level to unload from the Player (references are converted to paths when used in a string context).

Description

The unloadMovie( ) function is used most often to unload movies from document levels in the Player. For example, if a movie is loaded onto level 1 in the Player, we can unload that movie from the Player as follows:

unloadMovie("_level1");

The unloadMovie( ) function can also be used to unload movie clip instances, in which case it removes the content of the instance but not the instance itself. The instance is left on stage as an empty shell; we can load subsequent .swf or .jpg files into that shell. Hence, a single clip can act as a container for dynamic content that is managed through successive loadMovie( ) and unloadMovie( ) executions. Note that unloadMovie( ) differs from removeMovieClip( ) insofar as the latter removes a clip instance from memory, whereas the former removes content from a clip instance but leaves the clip instance shell otherwise intact.

Note that unloadMovie( ) executes asynchronously�the unload operation does not actually begin until after all scripts on the current frame execute.

Usage

The unloadMovie( ) function corresponds to the Unload Movie action with a target path in Flash 4.

See Also

loadMovie( ), MovieClip.removeMovieClip( ), MovieClip.unloadMovie( ), removeMovieClip( ), unloadMovieNum( ); "Removing Clip Instances and Main Movies," and "Method versus global function overlap issues," in Chapter 13


Table of Contents