First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: 123Webwizard | Website: http://webwizardinc.com/

Wow! two thumbs up for the Actionscript developers at Macromedia. Another amazing addition to Macromedia Flash MX 2004 is the MovieClipLoader Class. A backgrounder > In Flash MX 6, one could use the loadMovie method to load JPEG file or a swf file...

But now MovieClipLoader class lets you implement listener callbacks that provide status information while SWF or JPEG files are being loaded (downloaded) into movie clips.

After you issue the MovieClipLoader.loadClip() command, the following events take place in the order listed:

When the first bytes of the downloaded file have been written to disk, the MovieClipLoader.onLoadStart() listener is invoked. If you have implemented the MovieClipLoader.onLoadProgress() listener, it is invoked during the loading process. Note: You can call MovieClipLoader.getProgress() at any time during the load process.

When the entire downloaded file has been written to disk, the MovieClipLoader.onLoadComplete() listener is invoked. After the downloaded file's first frame actions have been executed, the MovieClipLoader.onLoadInit() listener is invoked. After MovieClipLoader.onLoadInit()has been invoked, you can set properties, use methods, and otherwise interact with the loaded movie.

If the file fails to load completely, the MovieClipLoader.onLoadError() listener is invoked.

Heres a little example of how it goes:

var wwinc_mcLoader = new MovieClipLoader();
wwinc_Listener = new Object();

wwinc_Listener.onLoadStart = function(target_mc) {
	/*your statements go here*/		

/*on initialize (frame 1 of target movie clip*/
wwinc_Listener.onLoadInit = function(target_mc) {
        /*your statements go here*/
/*loading done..*/
wwinc_Listener.onLoadComplete = function(target_mc) {
        /*your statements go here*/
wwinc_Listener.onLoadError = function(target_mc, errorCode) {
	trace("ERROR CODE = " + errorCode);
        /*take an action here...*/
/*adding the listener*/

/*finally load the image*/
wwinc_mcLoader.loadClip("http://webwizardinc.com/img/someimage.jpg", someMovieClip);

If you guys wanna see an implemented example of this, you can visit our website at: http://WebwizardInc.com/ and hit the > portfolio < link!

Have a ball...
Nasir Ali Sher.

» Level Intermediate

Added: 2003-09-23
Rating: 5 Votes: 38
(10 being the highest)
» Author
Im a Software Engieer... I just love this tool! Work on FLASH MX in my spare time :-)
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.