03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The value for target_mc identifies the movie clip for which this call is being made. This is<br />

useful when you are loading multiple files with the same set of listeners.<br />

Note: If you attempt to use onLoadProgress in test mode with a local file that resides on<br />

your hard disk, it does not work properly because, in test mode, Flash Player loads local files<br />

in their entirety.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 7<br />

Parameters<br />

target_mc:MovieClip [optional] - A movie clip loaded by the<br />

MovieClipLoader.loadClip() method.<br />

loadedBytes:Number - The number of bytes that had been loaded when the listener was<br />

invoked.<br />

totalBytes:Number - The total number of bytes in the file being loaded.<br />

Example<br />

The following example creates a movie clip, a new MovieClipLoader instance, <strong>and</strong> an<br />

anonymous event listener. It periodically outputs the progress of a load <strong>and</strong> finally provides<br />

notification when the load is complete <strong>and</strong> the asset is available to <strong>ActionScript</strong>.<br />

var container:MovieClip = this.createEmptyMovieClip("container",<br />

this.getNextHighestDepth());<br />

var mcLoader:MovieClipLoader = new MovieClipLoader();<br />

var listener:Object = new Object();<br />

listener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number,<br />

bytesTotal:Number):Void {<br />

trace(target + ".onLoadProgress with " + bytesLoaded + " bytes of " +<br />

bytesTotal);<br />

}<br />

listener.onLoadInit = function(target:MovieClip):Void {<br />

trace(target + ".onLoadInit");<br />

}<br />

mcLoader.addListener(listener);<br />

mcLoader.loadClip("http://www.w3.org/Icons/w3c_main.png", container);<br />

If your SWF file includes a version 2 component, use the version 2 component's<br />

DepthManager class instead of the MovieClip.getNextHighestDepth() method, which is<br />

used in this example.<br />

See also<br />

addListener (MovieClipLoader.addListener method), loadClip<br />

(MovieClipLoader.loadClip method), getProgress (MovieClipLoader.getProgress<br />

method)<br />

970 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!