Flash CS3 Documentation |
|||
| ActionScript 2.0 Language Reference > ActionScript classes > MovieClipLoader > onLoadProgress (MovieClipLoader.onLoadProgress event listener) | |||
Invoked every time the loading content is written to the hard disk during the loading process (that is, between MovieClipLoader.onLoadStart and MovieClipLoader.onLoadComplete). Call this listener on a listener object that you add by using MovieClipLoader.addListener(). You can use this method to display information about the progress of the download, by using the loadedBytes and totalBytes parameters.
The value for target_mc identifies the movie clip for which this call is being made. This is useful when you are loading multiple files with the same set of listeners.
Note: If you attempt to use onLoadProgress in test mode with a local file that resides on your hard disk, it does not work properly because, in test mode, Flash Player loads local files in their entirety.
Availability: ActionScript 1.0; Flash Player 7
target_mc:MovieClip [optional] - A movie clip loaded by the MovieClipLoader.loadClip() method.
loadedBytes:Number - The number of bytes that had been loaded when the listener was invoked.
totalBytes:Number - The total number of bytes in the file being loaded.
The following example creates a movie clip, a new MovieClipLoader instance, and an anonymous event listener. It periodically outputs the progress of a load and finally provides notification when the load is complete and the asset is available to ActionScript.
var container:MovieClip = this.createEmptyMovieClip("container", this.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number):Void {
trace(target + ".onLoadProgress with " + bytesLoaded + " bytes of " + bytesTotal);
}
listener.onLoadInit = function(target:MovieClip):Void {
trace(target + ".onLoadInit");
}
mcLoader.addListener(listener);
mcLoader.loadClip("http://www.w3.org/Icons/w3c_main.png", container);
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.
addListener (MovieClipLoader.addListener method), loadClip (MovieClipLoader.loadClip method), getProgress (MovieClipLoader.getProgress method)
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00002002.html