First time here? First time here? Newsletter Signup Newsletter
Login | Register | 651326 Members and growing!
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();

/*onLoadStart*/
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*/
wwinc_mcLoader.addListener(wwinc_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.
(123Webwizard)

» 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!

Comments

  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: work2survive
» Title: Girl Walking 1kb
» Description: Walking girl, animation just takes 1kb, using high heels shoes, and fashion model attitude.
Featured Sound Loops
Image for equalize

Audio Player

» Author: BoxCat
» Title: CPU Talk
» Description: From the cyberpunk RPG, "Nameless: the Hackers" Completely Free to use! Keywords: edm hip hop rap electronic mysterious mission hacking chase exciting spy ios ambient chilling love happy sad angry suspense
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: nathan
» Description:

A recorded sound of the Dimensional Fork Gate.