03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

};<br />

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

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 is loaded into a movie clip created at runtime:<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 />

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], loadedBytes, totalBytes) {}<br />

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

between MovieClipLoader.onLoadStart <strong>and</strong> MovieClipLoader.onLoadComplete). Call<br />

this listener on a listener object that you add using MovieClipLoader.addListener(). You<br />

can use this method to display information about the progress of the download, using the<br />

loadedBytes <strong>and</strong> totalBytes parameters.<br />

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

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

MovieClipLoader 491

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

Saved successfully!

Ooh no, something went wrong!