Why would bytesTotal increase in a AS3 preloader?

Posted by justkevin on Stack Overflow See other posts from Stack Overflow or by justkevin
Published on 2010-05-04T01:21:03Z Indexed on 2010/05/04 11:08 UTC
Read the original article Hit count: 270

Filed under:
|
|

I'm creating a custom preloader for a Flex app and have noticed the following behavior: when loading, the progress bar goes to 100%, then down then back up, and so on until the app is finished loading.

When I put a trace in the dowloadprogress listener, I see that while the app is loading, both bytesLoaded and bytesTotal increase, but not necessarily at the same time.

Code:

private function onDownloadProgress(event:ProgressEvent):void {
        var loaded:int = event.bytesLoaded;
        var total:int = event.bytesTotal;
        trace(event.target,loaded,total);
        _starfield.progress = loaded/total;
    }

Output:

[object Preloader] 134276 134276
[object Preloader] 265348 285007
[object Preloader] 285007 285007
[object Preloader] 678223 1322116
[object Preloader] 809295 1322116
[object Preloader] 1322116 1322116
[object Preloader] 1322116 1322116
[object Preloader] 1387652 1584342
[object Preloader] 1791882 1791882
[object Preloader] 2293133 2293133
[object Preloader] 2362938 2362938
[object Preloader] 2362938 2362938
[object Preloader] 2362938 2362938

Why does bytesTotal change during load?

© Stack Overflow or respective owner

Related posts about as3

Related posts about flex