views:

66

answers:

1

This is only a problem in IE.

the following actionscript is for a simple preloader for a movie i'm working on. It works fine in Firefox but the movie stops on the first frame of the preloader when opened with Internet Explorer. Has anyone had this problem before?

stop();

addEventListener(Event.ENTER_FRAME,checkLoad);
function checkLoad(e:Event):void {
var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;
bar_mc.scaleX=pcent/100;
loader_txt.text=int(pcent)+"%";
if (pcent==100) {
removeEventListener(Event.ENTER_FRAME,checkLoad);
this.gotoAndPlay(2);
}
}
A: 

Watch out for division-by-zero errors!

var pcent:Number=this.loaderInfo.bytesLoaded /this.loaderInfo.bytesTotal*100;

You cannot assume that loaderInfo knows the total number of bytes. Sometimes the sever wont tell the browser how big the file is going to be. In your case the file was probably already cached by Firefox but not IE.

Some people solve this by letting the swf know the file size beforehand, others configure their webserver to send this information.

bitc