Flex Multiplex Transfer Progress

I upload a file to the server using multipart URLLoader . I can upload the file in order. I tried to listen to the progress event on URLLoader, but it only starts at the very end of the download. How can I get the progress event more consistently through the download?

+6
flex file-upload
source share
1 answer

You have a progress bar:

 <mx:ProgressBar width="100%" id="progBar" mode="manual" /> 

Register a progress event handler:

 refUploadFile.addEventListener(ProgressEvent.PROGRESS, onUploadProgress); 

And process it:

 private function onUploadProgress(event:ProgressEvent):void { var numPerc:Number = Math.round( (Number(event.bytesLoaded) / Number(event.bytesTotal)) * 100); progBar.setProgress(numPerc, 100); progBar.label = numPerc + "%"; progBar.validateNow(); } 

If your files are small, it’s normal not to accept a lot of events. Try with large files.

+2
source share

All Articles