Reputation: 93
Why loaderInfo.bytesTotal
is Zero when run on server but run Test Movie it isn't zero?
My action(Preload)
stop();
addEventListener(Event.ENTER_FRAME,loaderF);
function loaderF(e:Event):void{
var toLoad:Number = loaderInfo.bytesTotal;
var loaded:Number = loaderInfo.bytesLoaded;
var total:Number = loaded/toLoad;
if(loaded == toLoad){
removeEventListener(Event.ENTER_FRAME,loaderF);
gotoAndStop(2);
}
else{
preloader_mc.preloaderFill_mc.scaleX = total;
preloader_mc.precent_txt.text = Math.floor(total*100)+" %";
preloader_mc.loaded_txt.text = loaded+" Bytes / "+toLoad+" Bytes";
}
}
Upvotes: 0
Views: 2727
Reputation: 33
The following code works for me:
loaderInfo.addEventListener(Event.COMPLETE, onComplete);
The only problem with this is when you get bytesTotal==0
you can't monitor load progress correctly. You only get a response when loading is complete.
Upvotes: 1
Reputation: 1068
I was getting this on a swf packaged (temporarily, during development) in Google App Engine. When I moved it to Google Cloud Storage, it was fine. Sure enough, when I compared the headers, App Engine wasn't including Content-Length. I did two things to prevent this in the future:
1) I hardcoded an estimated bytesTotal as a constant, and use that to determine the percent complete (if bytesTotal is zero) for purposes of showing a progress bar.
2) I changed my preloader to be a MovieClip and use currentFrame == totalFrames
to determine when the rest of the swf is definitely finished loading.
Upvotes: 0
Reputation: 5107
it's because you need to disable GZIP for swfs on your server.
add this to your .htaccess file:
SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary
Cost me a lot of time this morning
Upvotes: 3
Reputation: 809
Does it matter what browser? We are seeing reports this only happens in IE, not FF.
Upvotes: 0