javascript - ExternalInterface not working in IE - Stack Overflow

I am trying to call an action in a flash object from the javascript:as:function testExternalConnection(

I am trying to call an action in a flash object from the javascript:

as:

function testExternalConnection(str:String):Void {
    _root.debug.htmlText = "testExternalConnection ok";
}
ExternalInterface.addCallback("testExternalConnection", this, testExternalConnection);

js:

var movie = getFlashMovie("ap1_mod_hidden")
movie.testExternalConnection();

with

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}

I'm including my flash using swfobject:

<span id="ap1_mod_hidden"></span>
<script type="text/javascript">
    // Setting up the flash player
    var flashvars = {
        mp3Path: "stop",
        artistName : "",
        trackName : ""
    };
    var params = {
        codebase: '.cab#version=9,0,0,0',
        src: '/flash/ap1_mod.swf',
        quality: 'high',
        pluginspage: '',
        scale: 'showall',
        devicefont: 'false',
        bgcolor: '#999999',
        name: 'ap1_mod',
        menu: 'true',
        id: 'mod',
        allowFullScreen: 'false',
        allowScriptAccess:'always', //sameDomain
        movie: '/flash/ap1_mod.swf',
    wmode: "transparent",
    allowfullscreen: "true"
    };

    swfobject.embedSWF("/flash/ap1_mod.swf", "ap1_mod_hidden", "300", "300", "9.0.0", false, flashvars, params);
</script>

Nothing crazy here. So this code is working fine in everything but not in Internet Explorer (what a surprise :\ ). It is getting the movie object correctly but it is not able to call the externalinterface function. It's saying that the property is not defined.

I've looked on google and SO with no success... any help would be appreciated!

I am trying to call an action in a flash object from the javascript:

as:

function testExternalConnection(str:String):Void {
    _root.debug.htmlText = "testExternalConnection ok";
}
ExternalInterface.addCallback("testExternalConnection", this, testExternalConnection);

js:

var movie = getFlashMovie("ap1_mod_hidden")
movie.testExternalConnection();

with

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}

I'm including my flash using swfobject:

<span id="ap1_mod_hidden"></span>
<script type="text/javascript">
    // Setting up the flash player
    var flashvars = {
        mp3Path: "stop",
        artistName : "",
        trackName : ""
    };
    var params = {
        codebase: 'http://download.macromedia./pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
        src: '/flash/ap1_mod.swf',
        quality: 'high',
        pluginspage: 'http://www.macromedia./go/getflashplayer',
        scale: 'showall',
        devicefont: 'false',
        bgcolor: '#999999',
        name: 'ap1_mod',
        menu: 'true',
        id: 'mod',
        allowFullScreen: 'false',
        allowScriptAccess:'always', //sameDomain
        movie: '/flash/ap1_mod.swf',
    wmode: "transparent",
    allowfullscreen: "true"
    };

    swfobject.embedSWF("/flash/ap1_mod.swf", "ap1_mod_hidden", "300", "300", "9.0.0", false, flashvars, params);
</script>

Nothing crazy here. So this code is working fine in everything but not in Internet Explorer (what a surprise :\ ). It is getting the movie object correctly but it is not able to call the externalinterface function. It's saying that the property is not defined.

I've looked on google and SO with no success... any help would be appreciated!

Share Improve this question asked Jul 22, 2009 at 15:23 marcggmarcgg 66.6k53 gold badges183 silver badges236 bronze badges 1
  • Perhaps IE is cranky because you're not supplying the str argument to testExternalConnection. – Duncan Beevers Commented Jul 22, 2009 at 15:31
Add a ment  | 

1 Answer 1

Reset to default 5

I believe you want to use the id, not the div you're adding the swf too so:

function getFlashMovie(movieName) {
    return swfobject.getObjectById("mod");
}

since you're setting "mod" as the id.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745326726a4622691.html

相关推荐

  • javascript - ExternalInterface not working in IE - Stack Overflow

    I am trying to call an action in a flash object from the javascript:as:function testExternalConnection(

    7小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信