It took me a good few hours to whittle down to what was causing this issue, but despite that I haven’t been able to come up with a solution:
I’ve got a very basic test file that just fires a Javascript function with an alert() in it (i.e. alert(“You clicked a button.”);). In IE this works just fine, but in Firefox it wasn’t doing a thing. I finally realised it might be SWFObject, so I published the HTML file straight from Flash and all of sudden my ExternalInterface call works perfectly in Firefox as well.
Here’s my SWFObject embed code:
<script type="text/javascript">
var params = {};
var flashvars = {};
var attributes = {id:"testTool", name:"testTool"};
params.allowscriptaccess = "always";
params.bgcolor = "#B0E3DE";
params.wmode = "transparent";
flashvars.image = "babygro.jpg";
flashvars.prodname = "Baby Gro";
flashvars.desc = "It makes your baby gro.";
flashvars.prodid = "1";
flashvars.price = "£15.00";
flashvars.postURL = "http://www.site.com/?page_id=3&category=3&product_id=1";
swfobject.embedSWF("http://www.site.com/swf/test.swf", "maintool", "1024", "610", "9", false, flashvars, params, attributes);
</script>
<div id="maintool">
</div>
I’ve been googling this for about 4 hours and there are lots of mentions of the SWFObject requiring an ID attribute for addCallBack calls (hence the attributes object), and I’ve been through a whole bunch of posts in various forums but can’t pinpoint a single solution for ExternalInterface.call() not working with SWFObject in Firefox.
Any help would be greatly appreciated.