views:

423

answers:

2

Hello, I'm using SWFObject to embed flash on my site.

var so = new SWFObject("file.swf", "file", "100%", "100%", "8", "#FFFFFF");
so.addParam("wmode", "opaque");
so.addParam("allowscriptaccess", "always");
so.write(container);

This works like a charm in all browsers as far I can tell, but I'm also using fscommand from flash, and thus I'm having a function:

function file_DoFSCommand(command, args) {
    alert("It works!");
}

And this also works in all browsers I tested, except Firefox on windows, where the file_DoFSCommand doesn't get called (but the flash is displayed). Firefox mac and other browsers display "It works!" as expected. Very strange. If I remove "wmode", "opaque" it suddenly works, but then my css menu gets below the Flash so that's not an option. wmode = transparent doesn't seem to change anything.

Setting the so.addParam("allowscriptaccess", "never"); makes the other browsers behave like FF on windows when wmode is set.

Any suggestions why FF won't work?

A: 

First thing, try using ExternalInterface instead of FSCommand (depreciated somehow). There's a lot of examples around in SO already.

Theo.T
+1  A: 

@Theo.T, thanks for the tip. It didn't solve my problem though, but searching around for how to use ExternalInterface led me to a page saying IE wouldn't receive calls from flash when the container was hidden. My container wasn't hidden, but the height was set to 0:

<div id="flashcontainer" style="height:0">

Setting the height to 1px solved the problem and Firefox now successfully receives the calls from Flash

Mads Mobæk
Ha, that's an interesting one.
Theo.T