开发者

Preloader stalling flash movie in IE

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.loade开发者_开发技巧rInfo.bytesTotal*100;
bar_mc.scaleX=pcent/100;
loader_txt.text=int(pcent)+"%";
if (pcent==100) {
removeEventListener(Event.ENTER_FRAME,checkLoad);
this.gotoAndPlay(2);
}
}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜