我有一个非常简单的预加载器用于我的flash动画,当我在FLASH CC上发布它时它会起作用。我已经把问题缩小了,问题是e.target.bytesTotal 所以动作脚本认为e.target.bytesTotal是0,应该是846kbytes,但我不知道为什么。我试图用COMPRESS = deflate,COMPRESS = LDZ和NO COMPRESS发布swf 但它始终是e.target.bytesTotal = 0
import flash.net.URLRequest;
import flash.display.*;
import flash.events.Event;
import flash.events.ProgressEvent;
stop();
this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
this.loaderInfo.addEventListener(Event.COMPLETE, onComplete);
function onProgress(e:ProgressEvent):void
{
var loaded:Number = e.target.bytesLoaded;
var total:Number = e.target.bytesTotal;
var pct:Number = loaded/total;
loaded_txt.text = String((Math.round(pct * 100)));
}
function onComplete(e:Event):void
{
nextFrame();
}
答案 0 :(得分:1)
bytesLoaded以及bytesTotal是ProgressEvent本身的属性。
如此改变
var loaded:Number = e.target.bytesLoaded;
为:
var loaded:Number = e.bytesLoaded;
应该做的伎俩(当然是bytesTotal相同......)