User Guide
MovieClipLoader 953
Availability: ActionScript 1.0; Flash Player 7 - Support for unanimated GIF files, PNG files,
and progressive JPEG files is available as of Flash Player 8.
Parameters
target_mc:MovieClip [optional] - A movie clip loaded by the
MovieClipLoader.loadClip() method.
httpStatus:Number [optional] - (Flash Player 8 only) The HTTP status code returned by
the server. For example, a status code of 404 indicates that the server has not found anything
matching the requested URI. For more information about HTTP status codes, see sections
10.4 and 10.5 of the HTTP specification at ftp://ftp.isi.edu/in-notes/rfc2616.txt.
Example
The following example creates a movie clip, a new
MovieClipLoader instance, and an
anonymous event listener which listens for the
onLoadComplete event but waits for an
onLoadInit event to interact with the loaded element properties.
var loadListener:Object = new Object();
loadListener.onLoadComplete = function(target_mc:MovieClip,
httpStatus:Number):Void {
trace(">> loadListener.onLoadComplete()");
trace(">> =============================");
trace(">> target_mc._width: " + target_mc._width); // 0
trace(">> httpStatus: " + httpStatus);
}
loadListener.onLoadInit = function(target_mc:MovieClip):Void {
trace(">> loadListener.onLoadInit()");
trace(">> =============================");
trace(">> target_mc._width: " + target_mc._width); // 315
}
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var mc:MovieClip = this.createEmptyMovieClip("mc",
this.getNextHighestDepth());
mcLoader.loadClip("http://www.w3.org/Icons/w3c_main.png", mc);
If your SWF file includes a version 2 component, use the version 2 component's
DepthManager class instead of the
MovieClip.getNextHighestDepth() method, which is
used in this example.