User Guide

MovieClipLoader.onLoadProgress 613
MovieClipLoader.onLoadProgress
Availability
Flash Player 7.
Usage
listenerObject.onLoadProgress =
function([target_mc:Object [, loadedBytes:Number [, totalBytes:Number ] ] ]
) {
// 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.
loadedBytes The number of bytes that had been loaded when the listener was invoked.
totalBytes The total number of bytes in the file being loaded.
Returns
Nothing.
Description
Listener; invoked every time the loading content is written to disk during the loading process
(that is, between
MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete).
You can use this method to display information about the progress of the download, using the
loadedBytes and totalBytes parameters.
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 creates a progress bar using the Drawing API. The progress bar displays
the loading progress of an image using the
onLoadProgress listener. When the image finishes
loading, the progress bar is removed from the Stage. You must replace the URL parameter of the
image_mcl.loadClip() command so that the parameter refers to a valid JPEG file using HTTP.
If you attempt to use this example to load a local file that resides on your hard disk, this example
will not work properly because, in test movie mode, Flash Player loads local files in their entirety.
Add the following ActionScript to your FLA or AS file:
this.createEmptyMovieClip("progressBar_mc", 0);
progressBar_mc.createEmptyMovieClip("bar_mc", 1);
progressBar_mc.createEmptyMovieClip("stroke_mc", 2);
with (progressBar_mc.stroke_mc) {
lineStyle(0, 0x000000);
moveTo(0, 0);
lineTo(100, 0);