hi, guys!
I´m developing an application in Flash CS3, with AS 2.0.
I’ve been always using a custom class, wich extends MovieClipLoader and that have always worked well. But today it did not.
What is happening: the MovieClipLoader instance does not call “onLoadProgress” until all the file has been dowloaded. So, my preloader does not show any number. Just: “0%” and “100%”. But, this is the strange part: AFTER the jpg is downloaded, flash shows, at the same time, all the onLoadProgress´s tasks as the onLoadComplete tasks.
Thinking about all the classes the projetc has, I did a very simple flash, with a very simple code, like the “flash help” says:
On Stage, target is a MovieClip and pct_txt is a dynamic TextField.
var mcl:MovieClipLoader = new MovieClipLoader();
var listener:Object = new Object();
listener.onLoadProgress = function(target_mc:MovieClip, bl:Number, bt:Number):Void {
var pct:Number = Math.round((bl/bt) * 100);
pct_txt.text = "loading..." + pct;
trace("pct: " + pct);
}
listener.onLoadStart = function(target_mc:MovieClip):Void {
pct_txt.text = "start";
}
listener.onLoadComplete = function(target_mc:MovieClip):Void {
pct_txt.text = "end";
}
mcl.addListener(listener);
mcl.loadClip("http://www.ppwebart.com/projetos/fontenews/admin/uploads/fichas/10.jpg", target);
So, the sequence is:
- I call the line mcl.loadClip(“http://etc”, target)
- After 10 seconds, all at the same time: the image is showed, the percentage list of number is showed at the Output panel and the pct_txt.text shows the “end” word.
Well. Does anybody know why the “onLoadProgress” is not called during the process and not after all the process get finished ?
You can see this code in action at:
http://www.ppwebart.com/teste/testemcl.html
And the fla file at
http://www.ppwebart.com/teste/testemcl.fla
Thanks a lot!
Pedro Paulo Almeida
PS: the “getProgress()” method returns “undefined”. I have cleared the browser´s cache.