tags:

views:

31

answers:

1

I have a function that's called when a file download has reported progress:

        private function progressHandler(event:ProgressEvent):void
        {
            var percent:Number = Math.round((event.bytesLoaded / event.bytesTotal) * 100.0);
            Alert.show(event.bytesLoaded.toString());
            //pb.setProgress(percent, 100);
        }

Now, this should work fine but unfortunately, event.bytesLoaded is returning much larger values than it should. For a test file (8555 bytes), bytesLoaded goes all the way up to 8973384.

Any ideas why this might be happening?

A: 

Amarghosh, in his comment, gave the hint that lead to a solution.

"Is the file 8555 kilobytes - because the number you gave is close to 8555 * 1024"

SubSevn