Question

I've made a project that uses a preloader in the scene 1 and the content continues in the scene 2. The preloader have the follow code:

stop();

this.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loading);
this.loaderInfo.addEventListener(Event.COMPLETE, loaded);

function loading(e:ProgressEvent):void {
    text_txt.text = "Loading... "+int((this.stage.loaderInfo.bytesLoaded/this.stage.loaderInfo.bytesTotal)*100)+"%";
}

function loaded(e:Event):void {
    play();
}

When i tested in the local machine it worked, but when i upload to the server online the preloader shots to 100% and don't show the progress percent.

I've tried export classes to the frame 2 and error still continues. I'm using just only one TextField on the stage.

Was it helpful?

Solution

It's most likely one of the following two issues:

  1. The .swf is delivered by the server gzipped. This prevents the swf from starting until the whole file has been downloaded. You can see if it's being gzipped by opening the Dev tools (F12) in Chrome, go to the "network" tab and select the .swf and check for "Content-Encoding:gzip" under the "Response headers" headline. Note that you need to clear the browser cache first to make the browser download the .swf from the server, otherwise the Response headers won't be visible. Here's a relevant thread talking about gzip and swf: Preloader flash AS3 it's no longer working [GZIP issue].

  2. You embed the .swf on the html page with wmode parameter set to "transparent". It's a known bug several years old, so I would be surprised if that is still relevant today. But if you do embed with wmode it's a quick test to remove that parameter and see if the problem is resolved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top