Damian. So, a few things:
1) Read the Flex / SWFObject 2 Wiki page: http://code.google.com/p/swfobject/wiki/flex It tells you all about how to go about getting the two to play nice 2) setting ID / Name - You can do this easily through the attributes object. Setting these will ensure that the generated object tag will have the desired ID. <script type="text/javascript"> var flashvars = {}; var params = {}; var attributes = {}; attributes.id = "test"; attributes.name = "test"; swfobject.embedSWF("test.swf", "myAlternativeContent", "800", "600", "9.0.0", false, flashvars, params, attributes); Cheers, Aran -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Net Yaroze Sent: Saturday, 11 October 2008 5:17 PM To: SWFObject Subject: Flex 3 + Dynamic Publishing Hi everyone, I have been trying to dynamically add a Flex 3 application to the DOM and then call methods against that Flex application via JavaScript integration. Here's what I know so far (before coming across SWFObject): - Flex applications must have an outer <object> tag and an inner <embed> tag for JavaScript calls to work. The <object> tag must have an "id" attribute and the <embed> tag must have a "name" attribute; the values of these attributes have to match in order for JavaScript calls to work. - Adding a Flex application to the DOM using innerHTML creates the <object> parent element and <embed> child element in Firefox and Safari (haven't tested on Opera). Attempting to add the <embed> child element to the <object> parent in Internet Explorer raises an error. So... I turned to the Internet and came across SWFObject... I like what I see but can't see a way for dynamic publishing to enable me to embed a Flex 3 application in a way that will let me invoke JavaScript against it. Looking at the FABridge Flex 3 example, there is clear use of the <object> and <embed> tags which don't seem to be added by dynamic publishing. To test, I took a shot at combining dynamic publishing with Flex 3 / FABridge by adding the following lines to the <head> of the FABridgeSample.html file: <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> swfobject.embedSWF("app.swf", "flashoutput", "400", "400", "9.0.0", "expressInstall.swf"); </script> I then commented out the contents of the flashoutput <div> and loaded everything onto a local webserver. No go... After inspecting the DOM it seems that dynamic publishing won't create the <embed> child tag, nor set "id" and "name" attributes (were the <embed> tag to exist). Has anyone managed to get dynamic publishing to work with Flex 3 in a way which allows JavaScript calls to the Flex application? Any suggestion would be much appreciated! :-) Thanks, Damian --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/swfobject?hl=en -~----------~----~----~----~------~----~------~--~---
