User Guide
MovieClipLoader.loadClip() 605
MovieClipLoader.getProgress() and MovieClipLoaderListener.onLoadProgress do not
report the actual
bytesLoaded and bytesTotal values in the Authoring player when the files are
local. When you use the Bandwidth Profiler feature in the authoring environment,
MovieClipLoader.getProgress() and MovieClipLoaderListener.onLoadProgress report
the download at the actual download rate, not at the reduced bandwidth rate that the Bandwidth
Profiler provides.
Example
The following example illustrates the use of many of the MovieClipLoader class methods and
listeners:
// first set of listeners
var my_mcl:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myListener.onLoadStart = function(target_mc:MovieClip) {
trace("*********First my_mcl instance*********");
trace("Your load has begun on movie clip = "+target_mc);
var loadProgress:Object = my_mcl.getProgress(target_mc);
trace(loadProgress.bytesLoaded+" = bytes loaded at start");
trace(loadProgress.bytesTotal+" = bytes total at start");
};
myListener.onLoadProgress = function(target_mc:MovieClip, loadedBytes:Number,
totalBytes:Number) {
trace("*********First my_mcl instance Progress*********");
trace("onLoadProgress() called back on movie clip "+target_mc);
trace(loadedBytes+" = bytes loaded at progress callback");
trace(totalBytes+" = bytes total at progress callback");
};
myListener.onLoadComplete = function(target_mc:MovieClip) {
trace("*********First my_mcl instance*********");
trace("Your load is done on movie clip = "+target_mc);
var loadProgress:Object = my_mcl.getProgress(target_mc);
trace(loadProgress.bytesLoaded+" = bytes loaded at end");
trace(loadProgress.bytesTotal+" = bytes total at end");
};
myListener.onLoadInit = function(target_mc:MovieClip) {
trace("*********First my_mcl instance*********");
trace("Movie clip = "+target_mc+" is now initialized");
// you can now do any setup required, for example:
target_mc._width = 100;
target_mc._height = 100;
};
myListener.onLoadError = function(target_mc:MovieClip, errorCode:String) {
trace("*********First my_mcl instance*********");
trace("ERROR CODE = "+errorCode);
trace("Your load failed on movie clip = "+target_mc+"\n");
};
my_mcl.addListener(myListener);
// Now load the files into their targets.
// loads into movie clips
this.createEmptyMovieClip("clip1_mc", this.getNextHighestDepth());
clip1_mc._x = 400;
this.createEmptyMovieClip("clip2_mc", this.getNextHighestDepth());