I'm using this preloader AS3 code below. And it's not working! When I execute on Flash CS5.5 works fine, but not online.
var l:Loader = new Loader();
l.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, loop);
l.contentLoaderInfo.addEventListener(Event.COMPLETE, done);
l.load(new URLRequest("movie.swf"));
function loop(e:ProgressEvent):void
{
var perc:Number = e.bytesLoaded / e.bytesTotal;
percent.text = Math.ceil(perc*100).toString();
}
function done(e:Event):void
{
removeChildAt(0);
percent = null;
addChild(l);
}
I've found the problem and the solution!
The problem is because my online server have gzip on for mod_deflate option on Apache.
The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.
So the movie.swf was been compressed with gzip. That's the great problem.
SOLUTION HERE:
Well, just create or put some code into .htaccess file at server root folder.
Create a file (or put this code into) .htaccess
SetEnv no-gzip dont-vary
# Don't compress images/flash
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf|flv)$ no-gzip dont-vary
Have fun :P