预加载器在 IE 中停止 Flash 影片
这只是 IE 中的问题。
以下动作脚本是我正在制作的电影的简单预加载器。它在 Firefox 中工作正常,但当使用 Internet Explorer 打开时,影片会停在预加载器的第一帧上。以前有人遇到过这个问题吗?
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);
}
}
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);
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
注意除零错误!
您不能假设 loaderInfo 知道字节总数。有时服务器不会告诉浏览器文件有多大。在你的情况下,该文件可能已经被 Firefox 缓存,但不是 IE 缓存。
有些人通过预先让 swf 了解文件大小来解决此问题,其他人则配置其网络服务器来发送此信息。
Watch out for division-by-zero errors!
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.