Ok, well first thing to do, use the built in API method to target your Flash file:
http://code.google.com/p/swfobject/wiki/api var obj = swfobject.getObjectById("myId"); if (obj) { obj.doSomething(); // e.g. an external interface call } This method is tested, and this way we know the Flash file is being targeted correctly. 2) check out the test suite page demonstrating all the browser communication methods. It shows a nice clean way (with a little bit of error checking) of doing 2 way communications. http://code.google.com/p/swfobject/wiki/test_suite specifically: http://www.bobbyvandersluis.com/swfobject/testsuite_2_2/test_com.html If you re-implement the way the test page is receiving / calling methods through EI, and it still doesn't work, then it would point you in the direction of the swf rather than any js issue. Cheers, Aran On Thu, Aug 26, 2010 at 5:39 AM, colouredfunk <[email protected]>wrote: > Hello, > > I'm trying to get to JavaScript to communicate to a AS3 SWF, in both > FireFox and IE. IE works fine but not FF. I'm using the latest version > of SWFObject > > Here is my HTML: > > ------ > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// > www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > > <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> > <title>Untitled Document</title> > <script type="text/javascript" src="js/swfobject.js"></script> > <script type="text/javascript"> > swfobject.registerObject("wtw_main", "10.0.1", > "expressInstall.swf"); > </script> > <script type="text/javascript"> > function thisMovie(movieName) { > // var isIE = navigator.appName.indexOf("Microsoft") != -1; > // return (isIE) ? window[movieName] : document[movieName]; > if (navigator.appName.indexOf("Microsoft") != -1) { > return window[movieName]; > } else { > return document[movieName]; > } > } > > function menuUpdate(id) { > alert("id " + id); > thisMovie("wtw_main").onMenuCall(); > } > </script> > <style type="text/css"> > <!-- > #wrapper {width:968px} > #menu {width:198px;height:427px;float:left;} > #content {width:770px;height:470px;float:left;} > #footer {clear:both;} > --> > </style> > </head> > > <body> > <div id="wrapper"> > <div id="menu"> > <div> > <object > classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" > width="198" height="427" id="wtw_menu"> > <param name="movie" value="wtw_Menu.swf" /> > <param name="allowscriptaccess" value="always" /> > <!--[if !IE]>--> > <object type="application/x-shockwave-flash" > data="wtw_Menu.swf" > width="198" height="427"> > <param name="allowscriptaccess" value="always" /> > <!--<![endif]--> > <a href=" > http://www.adobe.com/go/getflashplayer"> > <img src=" > http://www.adobe.com/images/shared/download_buttons/ > get_flash_player.gif" alt="Get Adobe Flash player" /> > </a> > <!--[if !IE]>--> > </object> > <!--<![endif]--> > </object> > </div> > </div> > <div id="content"> > <div> > <object classid="clsid:D27CDB6E- > AE6D-11cf-96B8-444553540000" width="770" height="470" id="wtw_main" > name="wtw_main"> > <param name="movie" value="wtw.swf" /> > <param name="allowscriptaccess" value="always" /> > <!--[if !IE]>--> > <object type="application/x-shockwave-flash" > data="wtw.swf" width="770" height="470"> > <param name="allowscriptaccess" value="always" /> > <!--<![endif]--> > <a href="http://www.adobe.com/go/ > getflashplayer"> > <img src="http://www.adobe.com/images/ > shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash > player" /> > </a> > <!--[if !IE]>--> > </object> > <!--<![endif]--> > </object> > </div> > </div> > <div id="footer"></div> > </div> > </body> > </html> > ---------------------- > > The menuUpdate function gets called and displays the ID, but the > callback in the SWF doesn't get called. > > Here is the code in the wtw_main SWF: > > ---- > public class App extends Sprite > { > private var output:TextField > public function App() > { > output = new TextField(); > output.y = 25; > output.width = 450; > output.height = 325; > output.multiline = true; > output.wordWrap = true; > output.border = true; > output.text = "hello...\n"; > > if (ExternalInterface.available) { > try { > output.appendText("ready for JS\n"); > > ExternalInterface.addCallback("onMenuCall", onMenuCall); > > } catch (error:SecurityError) { > output.appendText("A SecurityError occurred: " + > error.message + "\n"); > } catch (error:Error) { > output.appendText("An Error occurred: " + > error.message + "\n"); > } > } else { > output.appendText("External interface is not available > for this container."); > } > addChild(output) > } > public function onMenuCall():void > { > output.appendText("Menu Call" + "\n"); > } > } > ------ > > Please can someone help me out, I've been stuck on this for days... > it's getting a bit silly now. > > Many thanks in advance! > > -- > 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]<swfobject%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/swfobject?hl=en. > > -- 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.
