After adding a custom preloader to my Flex app, I note that preloading doesn't work as expecting. Based on a previous problem with FLV files and compression (FLV preload don't work), I suspect of the same issue and get it. The preload fails in a server with gzip compression enabled for swf, while works ok in other server whitout gzip compression enabled.
So if you're having strange problems with your custom Flex preloader (or preloading FLV files) check if your server is applying compression and if that the case, disable for (at least) swf files (and FLV if you're having problems preloading videos)
Aditionally I want to copy an excerpt of a blog entry that you can read entirely here:
http://agaskar.com/as3-custom-flex-flash-preloaders-apache-2-moddeflate-formerly-known-gzip-and-a-sea-of-tears ... but I couldn't reach it, so find in Google cache and copy here just for completition and to not lost Rajan Agaskar advice
It wasn't a mime type issue -- looks like the swf mime type is, by default, in the mime.types of the Apache 2 distro for CentOS. Unfortunately, mod_deflate was turned ON ( also presumedly by default), and was busily gzipping everything in sight, including swfs. After another thirty minutes of searching, I found the following htaccess directives successfully turned off gzip compression for swf files (it also does a lot of other things, and I haven't had the time to refine it for just my purposes, so caveat emptor):
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \/image\.php no-gzip dont-vary
# Also don't compress PDF and Flash-files 17-01-2004 MM
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.swf$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
With this information you should be able to free yourself entirely (I hope) from having to fiddle with code in Flash CS3. This should keep me sane while I wait to get some time to set up the perfect AS3 environment in Linux so I can get back to using vim for editing.
UPDATE: gah! After thinking I had the definitive fix to this, I found that my preloaders *still* weren't working correctly. I spent another 4 hours working on the problem and have apparently fixed it server-wide. At issue was that the mod deflate directives did not seem to work correctly in .htaccess files. I haven't *fully* confirmed this (I'm happy enough that it's working on my server), but let me suggest the following fix, which *SO FAR* appears to work for me.
If you don't already have a mod_deflate.conf file in your /etc/httpd/conf.d/ dir (CentOS -- on Deb/Ubuntu this is probably in /etc/apache2/conf.d), create one and add the following:
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images/flash
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|swf|flv)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
I also want to note that if you're running something like Fiddler which proxies IE, the preloader does not appear to work either, which seems a fantastic illustration of the Heisenberg Uncertainty principle at work.