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.

target_mc.completeTimer = getTimer();<br />

};<br />

mclListener.onLoadInit = function(target_mc:MovieClip) {<br />

var timerMS:Number = target_mc.completeTimer-target_mc.startTimer;<br />

target_mc.createTextField("timer_txt", target_mc.getNextHighestDepth(),<br />

0, target_mc._height,<br />

target_mc._width, 22);<br />

target_mc.timer_txt.text = "loaded in "+timerMS+" ms.";<br />

};<br />

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

image_mcl.addListener(mclListener);<br />

image_mcl.loadClip("http://www.helpexamples.com/flash/images/image1.jpg",<br />

image_mc);<br />

The following example checks whether a movie has loaded into a movie clip created at<br />

runtime. The URL used in this example is for demonstration purposes only; replace it with<br />

your own valid URL.<br />

this.createEmptyMovieClip("tester_mc", 1);<br />

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

mclListener.onLoadInit = function(target_mc:MovieClip) {<br />

trace("movie loaded");<br />

}<br />

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

image_mcl.addListener(mclListener);<br />

image_mcl.loadClip("http://www.yourserver.com/your_movie.swf", tester_mc);<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), onLoadStart (MovieClipLoader.onLoadStart<br />

event listener)<br />

onLoadProgress (MovieClipLoader.onLoadProgress<br />

event listener)<br />

onLoadProgress = function([target_mc:MovieClip], loadedBytes:Number,<br />

totalBytes:Number) {}<br />

Invoked every time the loading content is written to the hard disk during the loading process<br />

(that is, between MovieClipLoader.onLoadStart <strong>and</strong><br />

MovieClipLoader.onLoadComplete). Call this listener on a listener object that you add by<br />

using MovieClipLoader.addListener(). You can use this method to display information<br />

about the progress of the download, by using the loadedBytes <strong>and</strong> totalBytes parameters.<br />

MovieClipLoader 969

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

Saved successfully!

Ooh no, something went wrong!