MattyIce
MattyIce

Reputation: 41

External Interface Calls To Flash Not Working in IE9

We have a flash game embedded in a web page (using SWFObject v2.2) and there are some links on the page that call into the flash in the following manner:

window.document["flashObjectId"].flashMethod();

This has worked great on all browsers we have tried including IE7 and 8, however on IE9 it generates the following error: "SCRIPT438: Object doesn't support this property or method".

It does work in compatibility mode so I tried adding a meta tag to tell IE9 to use compatibility mode by default, however that didn't work because our game runs in an IFrame within Facebook.

I have tried referencing the flash object every way I could think of in the Javascript but I always get that same error message in IE9. If anyone has any information that could help me get this to work in IE9 I would really appreciate it!

Upvotes: 3

Views: 6363

Answers (3)

OctoRazor
OctoRazor

Reputation: 26

What do you think about this?

function getFlashObject(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        //alert("IE");
        if (typeof (window[movieName].flashMethod) == 'function') {
            // < IE9
            movie = window[movieName];
        }
        else if (typeof (document[movieName].flashMethod) == 'function') {
            // >= IE9
            movie = document[movieName];
        }
    }
    else {
        // NON IE
        movie = document[movieName];
    }

    return ((movie) ? true : false);
}

$(document).ready(function () {
    if(getFlashObject("flashObjectId")) {
        movie.flashMethod();
    } else {
        alert("Failed to initialize");
    }
}

Upvotes: 0

A_developer
A_developer

Reputation: 66

This is probably the reason for your problem and solution is also provided here:

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

Upvotes: 2

JercSi
JercSi

Reputation: 1047

I had same problem, but i did not use SWFObject or AC_RunActiveContent.js.

My solution was: swf published with HTML and AC_RunActiveContent.js. Then i replaced my current code with exported from flash and it started working.

Upvotes: 0

Related Questions