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.

Share Article

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

Leave a reply

Please fill in the form fields and improve Skynet by completing the captcha!

Thank you! All comments are moderated so yours will appear shortly.

The War Master comes knocking at our gates. You are the vanguard, your body its bricks, your blood its mortar. Hold fast for as long as you can. I honour you each and every one for your sacrifice. Praetorians all, your names shall live on into eternity. Man the last gate and do it with defiance in your hearts and a clenched fist. Give the arch traitor nothing but make him pay for every meter with blood. We stand as one, unified in purpose. In the Emperors name and for all Terra, hold.

— Rogal Dorn, Horus Heresy: The Gates of Terra