Flash ProgressEvent does not show total size

I use ProgressEvent in Flash to determine how long it takes to load. I have it:

progress = event.target.bytesLoaded/event.target.bytesTotal; 

to set the percentage.

After some scratches in my head, I made a trace of two values ​​- and it turns out that "event.target.bytesTotal" is always zero.

I cannot find mention of this in the Flex / AS3 / Flash API. Any tips on how to get bytesTotal to work?

(I am now reading from a PHP file on a web server)

+4
source share
2 answers

You tried:

  progress = event.bytesLoaded/event.bytesTotal; 

bytesTotal / bytesLoaded should be a property of the progress event.

Also ... I had this problem yesterday and it stopped me completely until I thought to check the file I was loading and it turned out to be corrupted and 0 bytes - so double check it :)

+1
source

We solved this problem on our server by disabling the compression of some file types.

Total byte was 0 for files that were compressed. This compression occurs on the fly, so the server cannot provide the file size (because it does not know it yet). Removing the compression helped solve the problem.

+4
source

All Articles