开发者

Flex event.bytesLoaded returning wrong value

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开发者_C百科 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?


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"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜