Add fix for 0-byte-reporting browsers
authorAndy Allan <gravitystorm@gmail.com>
Fri, 14 Jan 2011 16:48:22 +0000 (16:48 +0000)
committerAndy Allan <gravitystorm@gmail.com>
Fri, 14 Jan 2011 16:48:22 +0000 (16:48 +0000)
net/systemeD/potlatch2/PreloaderDisplayBase.as

index c8c0e80..aa93e94 100644 (file)
@@ -97,6 +97,11 @@ package net.systemeD.potlatch2
         {
             _bytesLoaded = event.bytesLoaded;
             _bytesExpected = event.bytesTotal;
+
+            // Some browsers got nuts when the swf is served with gzip encoding and report bytesTotal as zero
+            if(_bytesExpected == 0) {
+                _bytesExpected = _bytesLoaded; // This is how Firefox behaves anyway in such cases
+            }
             _fractionLoaded = Number(_bytesLoaded) / Number(_bytesExpected);
 
             draw();