SWFObject 2.2 and Safari Gotcha 3

Posted by Kristofer Joseph Fri, 22 Jan 2010 17:32:39 GMT

When setting the style class attribute using dynamic embedding with SWFObject, Safari will throw a parse error and not embed your Flash file. You need to use object bracket notation instead of dot notation.

Example: foo["pantyhose"] instead of foo.pantyhose

<head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <script type="text/javascript" src="assets/js/swfobject.js"></script>
    <script type="text/javascript">
        var flashvars = {};
        flashvars.event = "%2fevent_guid_1%2f";
        var params = {};
        var attributes = {};
        attributes["class"] = "flashcontent";
        attributes.id = "FlashContent";
        swfobject.embedSWF("yourHappySWF.swf", "alternativeContent", "100%", "100%", "9.0.0", false, flashvars, params, attributes);
    </script>
    <style type="text/css" media="screen"> 
        html, body  { height:100%; }
        body { margin:0; padding:0; overflow:auto; text-align:center; }   
        #flashcontent { display:none; }
    </style>
</head>
Comments

Leave a comment

  1. viagra livraison rapide about 1 year later:

    The excellent tutorial and it is definitely going to help me some time. Really good ideas.

  2. pozycjonowanie about 1 year later:

    Great blog post, I have been waiting for that

  3. programy about 1 year later:

    I think this is one of the most important information for me. And i’m glad reading your article. But wanna remark on few general things, The website style is great, the articles is really excellent. Good job, cheers

Comments