958
ActionScript classes
totalBytes
:Number
- The total number of bytes in the file being loaded.
Example
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( ".onLoadProgress with " + bytes " bytes of " +
bytesTotal);
}
listener.onLoadInit = function(target:MovieClip):Void {
trace( ".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.
See also
addListener (MovieClipLoader.addListener method)
,
loadClip
(MovieClipLoader.loadClip method)
,
getProgress (MovieClipLoader.getProgress
method)
onLoadStart (MovieClipLoader.onLoadStart event
listener)
onLoadStart = function([target_mc:MovieClip]) {}
Invoked when a call to
MovieClipLoader.loadClip()
has begun to download a file. Call
this listener on a listener object that you add by using
MovieClipLoader.addListener()
.
The value for
target_mc
identifies the movie clip for which this call is being made. This
parameter is useful if you are loading multiple files with the same set of listeners.
Availability:
ActionScript 1.0; Flash Player 7
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...