ProgressEvent.PROGRESS misreports bytesLoaded & bytesTotal

One problem you might run into involves ProgressEvent.PROGRESS events seeming to misreport the proportion of the file that has loaded.

This would cause a preloader’s bar to extend beyond the 100% mark. We don’t have time currently to outline the full technical context of the issue, but did spend some time examining it, and we solved it.

The solution to the problem was not to use the bytesLoaded and bytesTotal of the actual ProgressEvent in the event listener, but to instead use the properties of the target (which is a LoaderInfo object). So your code looks like this:

private function update(e:ProgressEvent):void
  // causes misreport:
  // var bt:uint = e.bytesTotal;
  // var bl:uint = e.bytesLoaded;

  // prevents misreport:
  var bt:uint =;
  var bl:uint =;

  bar.scaleX = bl/bt;

We’ll try to expand on this issue at a later time.

Cheap web hosting

Comments on this post

  1. Elena says:

    I have used this code for a video, i have had to convert the connett flv to swf as our intranet at work will not show flv files. This swf video is in scene 2 and the preloader is in scene 1 exactly and is exatly as above.The preloader works fine when i simulate download but when I upload it only our intranet site, the whole thing does not show up untill it is fully downloaded, there there is a quick flash of the preloader and the movie begins to play. I cannto for the life of me figure out how to correct it. Is it because I am using an intranet site?

Add a comment: