Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does my call from flash to Javascript fail in IE9?

I have a couple of buttons in my flash application that call two different javascript functions. They work in all browsers except IE9 (I haven't tried earlier IEs). My code to call the function is something like this:

ExternalInterface.call(
        "myLovelyFunction",
        string1, string2);

and the code in the JS looks like this:

function myLovelyFunction(string1, string2) {
    window.open('https://twitter.com/share?url=http%3A%2F%2Fwww.mysite.com%2Fapage.php&via=atwitteraccount&text=Some%20text%22&related=atwitteraccount',
    'windowname',
    'height=290,width=510');
}

In IE9, the function does absolutely nothing, but the console complains with:

SCRIPT438: Object doesn't support property or method 'SetReturnValue' 
index.php, line 1 character 1

line 1, character 1 is obviously pointing at nothing in particular.

I can make it work fine by switching on compatability view, although the console error doesn't go away.

Is there anything about IE9 that causes this, and more importantly, how do I fix this?

like image 793
izb Avatar asked Nov 18 '11 23:11

izb


2 Answers

I had this very same issue as well. I was using the following code:

    <object type="application/x-shockwave-flash" data="/files/banners/64/64_300x250.swf" width="300" height="250">
      <param name="movie" value="/files/banners/64/64_300x250.swf"/>
      <param name="wmode" value="transparent"/>
    </object>

I'm just embedding the flash with a regular object tag (no SWFObject and no embed fallback). My flash file calls the JS function window.open via ExternalInterface like this:

ExternalInterface.call("window.open", url, target, features);

What didn't work: The link above suggests changing it to "document.open", which did not work. Also attempting to force the page to render in IE-8 mode did not work. For example:

<meta http-equiv="X-UA-Compatible" content="IE=8" />

What did work: Simply adding a "name" and "id" to the object tag solved the issue. For example:

<object type="application/x-shockwave-flash" data="/files/banners/64/64_300x250.swf" width="300" height="250" name="flash_object" id="flash_object">
like image 153
Jeremy Knight Avatar answered Oct 01 '22 08:10

Jeremy Knight


Had absolutely the same issue, link below helped to solve it.

http://msdn.microsoft.com/en-us/library/gg622942%28v=VS.85%29.aspx

like image 32
src091 Avatar answered Oct 01 '22 08:10

src091