我正在制作我的第一个 Flash 照片库,当我单击缩略图时,它应该以全尺寸打开图片并显示带有百分比的预加载器。这一切都在闪存下载模拟器上离线工作,但在线百分比不会显示。它有时会开始显示大约 100% 或根本不显示。画廊链接:http ://solarratko.netii.net/ 下面是我班级的一些代码,用于加载全尺寸图像
public function kreni(f:String) //function that start when user click on thumbnail
{
URLrequest=new URLRequest(f); //URLrequest for image in full size
dspLoader.load(URLrequest); //loading the image
preloader.visible = true;//prelaoder that shows up is visible
h.visible=true;//text area for percentage is visible
dspLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, progres);//adding progress event
dspLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, kraj);//adding complete event
}
public function progres(e:Event):void
{
var perc:Number = e.target.bytesLoaded / e.target.bytesTotal;//calculatin percentage
h.text = Math.ceil(perc*100).toString();//displaying percentage wich is not working online or it start too late
}
public function kraj(e:Event):void
{
h.text="";
preloader.visible = false;
h.visible=false;
}