0

我正在制作 Flash Photogallery,但我的预加载器有问题。我的画廊离线工作正常(在模拟下载中),但问题是当它在线时加载百分比不会显示。到目前为止,我发现当画廊加载全尺寸图像时 ProgressEvent 没有触发。有时它会 100% 触发,有时它会按时触发,但通常不会触发。这是我的画廊的链接和一些代码: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;
    }
4

0 回答 0