You are loading your images at the same time !
Load the first image and then onLoadComplete, start loading the second
image...
----- Original Message -----
From: "lincoln" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, April 12, 2006 11:39 PM
Subject: [Flashcoders] Reusing MovieClipLoader Listeners
I have a function that I'm using to preload images into a container clip
using the MovieClipLoader class. The preloader works fine on the initial
image but on successive calls to the function, the onLoadProgress
seemingly never fires (in order to update the percentage in a textfield).
However, the onLoadInit does fire and the preloader fades away. The
manual says to use onLoadComplete for repeated usages of listeners, but it
doesn't seem to allow me to continuously reuse the listener to load in
another image. How do I set this up to allow multiple calls to the
function and have the preloader fire from 0%->100%?
function preloadImage(img:String,target:MovieClip):Void{
var mclListener:Object = new Object();
var image_mcl:MovieClipLoader = new MovieClipLoader();
image_mcl.addListener(mclListener);
mclListener.onLoadComplete = function(target_mc:MovieClip,
httpStatus:Number):Void {
// should I remove the listener here and delete the obj?
}
/*
this function never fires properly after the first call!
*/
mclListener.onLoadProgress = function(target:MovieClip,
bytesLoaded:Number, bytesTotal:Number):Void {
photoLoaded = Math.round(100/bytesTotal*bytesLoaded);
MainLoader.load_text.LoadPer1.text = "Loading "+photoLoaded+"%";
}
mclListener.onLoadInit = function(target_mc:MovieClip) {
preloadFadeOut();
};
image_mcl.loadClip(img, target);
};
preloadImage("images/5.2.1a.jpg", image_mc); // this one preloads great!
preloadImage("images/5.2.2a.jpg", image_mc); // this does not have
onLoadProgress but fires onLoadInit
any ideas? thanks!
-l
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com