I am uploading a file to a server using a multipart URLLoader
. I am able to upload the file fine. I have tried to listen to the progress event on the URLLoader but it only fires at the very end of the upload. How do I get the progress event more consistently through the upload?
Have a progress-bar:
<mx:ProgressBar width="100%" id="progBar" mode="manual" />
Register a progress event handler:
refUploadFile.addEventListener(ProgressEvent.PROGRESS, onUploadProgress);
And handle 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 is normal to not receive many events. Try with bigger files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With