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
1 Answer
Reset to default 5I 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.