|
flex
SWFObject 2 and Adobe Flex integration
SWFObject 2 and Adobe Flex integrationOne question we hear a lot is: Does SWFObject 2 support Adobe Flex? The answer is: Yes, SWFObject 2 fully supports Adobe Flex, using both static and dynamic publishing. However, some JavaScript code that ships with Adobe Flex does currently not support SWFObject 2. There are known issues with the following JavaScript files:
What's the problem?The main difference between embedding Flash content into HTML using Flex publishing templates or SWFObject 2 is that Flex uses the so called twice-cooked method, while SWFObject static publishing uses the nested objects method and SWFObject dynamic publishing serves the right object or embed element to the right browser. An overview of the differences:
While:
Note: Opera can interpret both the Microsoft platform specific and generic object notation, and if both object elements are nested it will use the first implementation it encounters. However it somehow prefers the embed element over the object element, so whenever a nested embed element is encountered, this will be used instead. Both history.js (the getPlayer function) and FABridge.js (the FABridgebridgeInitialized function) use a centralized function to reference SWFs, however the problem is that they currently only expect a twice-cooked notation and cannot deal with anything else. What's the solution?To help the Adobe Flex team integrate with SWFObject 2 we have updated the history.js and FABridge.js in a way that they work with both the Adobe Flex publishing templates and with SWFObject 2. Because we are not the original authors of these libraries and we are by no means Flex authors ourselves, we would love to hear your feedback if these updated JavaScript files work fine for you (please use the comments at the bottom of this page). You can find the updated JavaScript files and sample pages here. A more elegant solution?Our updated JavaScript files try to avoid browser sniffing (like originally used in FABridge.js) to select the object or embed element that is actually used by the browser (please note that there can be object or embed elements available in your mark-up that are not used), instead we the following feature test to see if an element can be referenced: if (typeof element.SetVariable != "undefined") { ... }Note: In Safari this test is also always true for non-used nested embed elements (inside a twice-cooked definition). |
This is very similar to a solution that I came up with when having trouble integrating FABridge with swfobject. I basically just commented out some code in FABridge.js to fix it, though. It would be interesting to see if our solutions behave differently.
http://blog.innerfence.com/2008/06/05/using-fabridge-and-swfobject-together/
I've came with very simple solution: swfobject.embedSWF ( "${swf}.swf", "${application}div", "${width}", "${height}", "${version_major}", "expressInstall.swf", flashvars, params, attributes ); swfobject.addLoadEvent(loadEventHandler); function loadEventHandler() { } and made flex template for SWFObject 2. For more info take a look at http://olegflex.blogspot.com/2008/06/swfobject-2-flex-template.html
I was having problems getting FABridge to work right on Safari. The updated FABridge.js from this project fixed the problem.
Thanks!