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.

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

bytesTotal:Number):Void {<br />

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

bytesTotal);<br />

}<br />

mcLoader.addListener(listener);<br />

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

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

interval.id = setInterval(checkProgress, 100, mcLoader, image, interval);<br />

function checkProgress(mcLoader:MovieClipLoader, image:MovieClip,<br />

interval:Object):Void {<br />

trace(">> checking progress now with : " + interval.id);<br />

var progress:Object = mcLoader.getProgress(image);<br />

trace("bytesLoaded: " + progress.bytesLoaded + " bytesTotal: " +<br />

progress.bytesTotal);<br />

if(progress.bytesLoaded == progress.bytesTotal) {<br />

clearInterval(interval.id);<br />

}<br />

}<br />

See also<br />

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

(MovieClipLoader.onLoadProgress event listener)<br />

loadClip (MovieClipLoader.loadClip method)<br />

public loadClip(url:String, target:Object) : Boolean<br />

Loads a SWF or JPEG file into a movie clip in Flash Player while the original movie is<br />

playing. Using this method lets you display several SWF files at once <strong>and</strong> switch between<br />

SWF files without loading another HTML document.<br />

Using the loadClip() method instead of loadMovie() or MovieClip.loadMovie() has a<br />

number of advantages. The following h<strong>and</strong>lers are implemented by the use of a listener object.<br />

You activate the listener by using MovieClipLoader.addListener(listenerObject) to<br />

register it with the MovieClipLoader class.<br />

■ The MovieClipLoader.onLoadStart h<strong>and</strong>ler is invoked when loading begins.<br />

■ The MovieClipLoader.onLoadError h<strong>and</strong>ler is invoked if the clip cannot be loaded.<br />

■ The MovieClipLoader.onLoadProgress h<strong>and</strong>ler is invoked as the loading process<br />

progresses.<br />

MovieClipLoader 485

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

Saved successfully!

Ooh no, something went wrong!