PDA

View Full Version : MovieClipLoader


chuckgrenade
01-30-2006, 07:43 PM
So here's my trouble. I am in the belief that you can have a progress bar while using the MovieClipLoader. Well, not only can I not get that to work, but my .swf isn't loading either. So below I have script that creates a moviecliploader, changes the progress bar onProgress, and then continues on the timeline onComplete. Do I need a listener?



//create a MovieClipLoader
var MCL = new MovieClipLoader();

//changes the progress bar as the .swf is loaded
MCL.onLoadProgress = function(target, bytesLoaded, bytesTotal) {
this.ProgressBar._xscale = (bytesLoaded/bytesTotal)*100;
};

//Continues the movieclip after the .swf is loaded(I asume the MovieClipLoader stops the timeline from plaing when it hits the event)
MCL.onLoadComplete = function(target) {
play();
};

//load my .swf
MCL.loadClip("thefile.swf", "this.theMC");



HELP!!!

Slowburn
01-31-2006, 04:40 AM
you have scope issues. MCL is not a MovieClip, it's an Object object. So calling play() shouldn't actually work. instead you will need a target to prefix that statement. `this` will not work, as this still referes to the MovieClipLoader Object.


var _mcl = new MovieClipLoader();
myListener = new Object();
myListener.onLoadProgress = function (target_mc, loadedBytes, totalBytes) {
__scope__.ProgressBar._xscale = (loadedBytes / totalBytes) * 100;
}
myListener.onLoadComplete = function(target_mc) {
// target_mc.stop();
__scope__.play();
}
_mcl.addLisneter(myLisneter);
_mcl.loadClip("file.swf", "targetMovieClip");