Prevent Flash White Box Flicker

Recently a few people have asked me how to prevent that flicker of a white box just prior to the swf file being loaded in a browser. It’s quite noticable against a dark HTML/CSS background color. The simple fix is to set the bgcolor property via HTML. If you’re using the old skool Flash generated HTML then you should add this param to the others. Also remember to set the value on the embed line.

<param name="bgcolor" value="000000" />

Here’s how to do it with swfobject:

swfobject.embedSWF("your-file.swf", "div_id_to_replace", "1024", "768", "9.0.0", "expressInstall.swf", {}, {bgcolor:"000000"});

It works best on a flat color background. A recent project I was on involved a solid black (0x000000) background. Even though the background for the Flash document was set to black via the IDE it still flickered white slightly prior the swf data being read. The fix for me was to add the parameter to the swfobject call.

The same easy fix doesn’t really work on a textured background since it would just set it to be a solid block. My advice for here is to just pick a color that ties in nicely with your theme. The point here would be that it doesn’t have to be the default white.

Comments: None so far...be the first!

Leave a reply

Your email address will not be published. Required fields are marked *

Pain’s good, reminds me I’m alive!

— Riddick