Search Tutorials
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 Have a ball...
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|