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

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

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

Invoked when a file loaded with MovieClipLoader.loadClip() is completely downloaded.<br />

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

useful if multiple files are being loaded with the same set of listeners.<br />

This parameter is passed by Flash to your code, but you do not have to implement all of the<br />

parameters in the listener function.<br />

When you use the onLoadComplete <strong>and</strong> onLoadInit events with the MovieClipLoader class,<br />

it's important to underst<strong>and</strong> how this differs from the way they work with your SWF file. The<br />

onLoadComplete event is called after the SWF or JPEG file is loaded, but before the<br />

application is initialized. At this point you cannot access the loaded movie clip's methods <strong>and</strong><br />

properties, <strong>and</strong> because of this you cannot call a function, move to a specific frame, <strong>and</strong> so on.<br />

In most situations, it's better to use the onLoadInit event instead, which is called after the<br />

content is loaded <strong>and</strong> is fully initialized.<br />

Parameters<br />

listenerObject: - A listener object that was added using MovieClipLoader.addListener().<br />

target_mc: [optional] - A movie clip loaded by a MovieClipLoader.loadClip() method. This<br />

parameter is optional.<br />

Example<br />

The following example loads an image into a movie clip instance called image_mc. The<br />

onLoadInit <strong>and</strong> onLoadComplete events are used to determine how long it takes to load the<br />

image. The information appears in a dynamically created text field called timer_txt.<br />

this.createEmptyMovieClip("image_mc", this.getNextHighestDepth());<br />

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

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

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

};<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, 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.macromedia.com/images/shared/product_boxes/<br />

112x112/box_studio_112x112.jpg", image_mc);<br />

488 ActionScript classes

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

Saved successfully!

Ooh no, something went wrong!