Tuesday, March 17, 2009

SWFObject , Firefox, and Blank Screens - Oh My!

Well I had a RTFM moment when my Firefox 3 browser recently stopped displaying my flash application a.k.a Blank Screen Syndrome.



I was using the following dynamic technique with SWFObject 2.1 with the width and height set to 100%.

<script type="text/javascript">
swfobject.embedSWF("myContent.swf", "myContent", "100%",
"100%", "9.0.0");
</script>

I won’t bore you with the weird and wonderful solutions attempted and failed through a particularly frustration few hours – none of which I will ever get back.

As a last resort I poured through the documentation with a desperate vigour and turned up this little gem:

because Firefox in standards compliant mode interprets percentages in a very strict way (to be precise: the percentage of the height of its parent container, which has to be set explicitly):

<style type="text/css" media="screen">
html, body, #containerA, #containerB { height:100%; }
body { margin:0; padding:0; overflow:hidden; }
</style>

Suffice it to say this fixes the no show <ahem> “bug” in Firefox 3.

In a rather poor sportsman like manner I will point out that this little titbit is not in the Documentation section of the wiki but rather the FAQ. The fix is also conspicuously absent from the sample code downloaded with the installation and even the fancy (and extremely convenient) SWFfObject Generator does not create these styles.

Stay tuned for more glorious RTFM moments.

3 comments:

  1. Oh thanks man !
    You save my day ; )

    ReplyDelete
  2. This fix did not work for me. Everything is fine in IE and Safari, and if I change the object width and height to a fixed pixel amt then it shows in FF, but not 100% which is what I need to center this. Argggg

    ReplyDelete
  3. Casino Online Casinos - Review & Rating by Casinoowed
    Casino Online casinos are one of 온카지노 the largest online 인카지노 gaming sites in the world and have become very popular งานออนไลน์ worldwide. With the rise of casinos

    ReplyDelete