User Guide
644 Chapter 7: ActionScript for Flash
See also
MovieClipLoader.getProgress()
MovieClipLoader.onLoadStart
Availability
Flash Player 7.
Usage
listenerObject.onLoadStart = function([target_mc:Object]) {
// your statements here
}
Parameters
listenerObject
A listener object that was added using MovieClipLoader.addListener().
target_mc A movie clip loaded by a MovieClipLoader.loadClip() method. This parameter
is optional.
Returns
Nothing.
Description
Listener; invoked when a call to MovieClipLoader.loadClip() has successfully begun to
download a file. The value for
target_mc identifies the movie clip this call is being made for.
This is useful if you are loading multiple files with the same set of listeners. This optional
parameter is passed to your ActionScript.
Example
The following example loads an image into a movie clip instance called image_mc. The
onLoadInit and onLoadComplete events are used to determine how long it takes to load the
image. This information displays in a text field called
timer_txt.
this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());
var mclListener:Object = new Object();
mclListener.onLoadStart = function(target_mc:MovieClip) {
target_mc.startTimer = getTimer();
};
mclListener.onLoadComplete = function(target_mc:MovieClip) {
target_mc.completeTimer = getTimer();
};
mclListener.onLoadInit = function(target_mc:MovieClip) {
var timerMS:Number = target_mc.completeTimer-target_mc.startTimer;
target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(), 0,
target_mc._height, target_mc._width, 22);
target_mc.timer_txt.text = "loaded in "+timerMS+" ms.";
};
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
image_mcl.loadClip("http://www.macromedia.com/images/shared/product_boxes/
112x112/box_studio_112x112.jpg", image_mc);