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>

Flex & Rails: REST Fix 3

Posted by Kristofer Joseph Sun, 10 Jan 2010 07:34:01 GMT

Before Rails 2.3.1 you could send a PUT request with application/xml contentType by appending ?_method=put to your HTTPServices url parameter. Unfortunately this stopped working. You can accomplish the same thing by sending a custom header of #X-Http-Method-Override# and setting it to PUT, or DELETE.

Example

If you have an update HTTPService like so:

<mx:HTTPService id="updateThing"
                resultFormat="e4x"
                url="http://localhost:3000/thing/{dataGrid.selectedItem.id}.xml"
                contentType="application/xml"
                method="POST"
                result="index.send()" />

You would add your custom header like this:

    /**
    * @private
    */
   protected function update_thing():void
   {
        var thing:XML = new XML(_thingXMLTemplate);
        thing['first-name'] = firstNameInput.text;
        thing['last-name'] = lastNameInput.text;
        var headers:Object = new Object();
        headers['X-Http-Method-Override'] = "PUT";
        updatePerson.headers = headers;
        updatePerson.send(thing);
   }

*Note the headers['X-Http-Method-Override']

Same goes for sending a DELETE. Hope this helps.