User Guide

MovieClip 889
See also
beginFill (MovieClip.beginFill method), createEmptyMovieClip
(MovieClip.createEmptyMovieClip method)
, endFill (MovieClip.endFill method),
lineStyle (MovieClip.lineStyle method), moveTo (MovieClip.moveTo method)
loadMovie (MovieClip.loadMovie method)
public loadMovie(url:String, [method:String]) : Void
L o a d s a S W F, J P E G , G I F, o r P N G f i l e i n t o a m o vie clip in Flash Player while the original
SWF file is playing. Support for unanimated GIF files, PNG files, and progressive JPEG files
is added in Flash Player 8. If you load an animated GIF, only the first frame is displayed.
Without the
loadMovie() method, Flash Player displays a single SWF file and then closes.
The
loadMovie() method lets you display several SWF files at once and switch between SWF
files without loading another HTML document.
A SWF file or image loaded into a movie clip inherits the position, rotation, and scale
properties of the movie clip. You can use the target path of the movie clip to target the loaded
SWF file.
When you call the
loadMovie() method, set the MovieClip._lockroot property to true in
the loader movie, as the following code example shows. If you don't set
_lockroot to true in
the loader movie, any references to
_root in the loaded movie point to the _root of the
loader instead of the
_root of the loaded movie:
myMovieClip._lockroot = true;
Use the MovieClip.unloadMovie() method to remove SWF files or images loaded with the
loadMovie() method.
Use the
MovieClip.loadVariables() method, the XML object, Flash Remoting, or Runtime
Shared Objects to keep the active SWF file and load new data into it.
Using event handlers with
MovieClip.loadMovie() can be unpredictable. If you attach an
event handler to a button by using
on(), or if you create a dynamic handler by using an event
handler method such as
MovieClip.onPress(), and then you call loadMovie(), the event
handler does not remain after the new content is loaded. However, if you attach an event
handler to a movie clip by using
onClipEvent() or on(), and then call loadMovie() on that
movie clip, the event handler remains after the new content is loaded.
When using this method, consider the Flash Player security model.
TIP
To monitor the progress of the download, use the MovieClipLoader.loadClip() method
instead of the
loadMovie() method.