External Interface not working?
In my flash I have this (AS2) :
function playSongJS(str:String, sta:Number, sto:Number):Void {
// do things
}
flash.external.ExternalInterface.addCallback("playSongJS", this, playSongJS);
Then I call it like this:
function getFlashMovie(movieName) {
var movie = document.getElementById("ap1_mod");
return movie;
}
function playSongWithTime(my_file, start, end) {
getFlashMovie("ap1_mod").playSongJS("test.mp3", 0, 50);
}
I include it using SWFObject:
<div id="ap1_mod"></div>
<script type="text/javascript">
var flashvars = {
mp3Path: "stop",
artistName : "",
trackName : ""
};
var params = {
codebase: 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0',
src: '/public/flash/ap1_mod.swf',
quality: 'high',
pluginspage: 'http://www.macromedia.com/go/getflashplayer',
scale: 'showall',
devicefont: 'false',
bgcolor: '#999999',
name: 'ap1_mod',
menu: 'true',
allowFullScreen: 'false',
allowScriptAccess:'always', //sameDomain
movie: '/public/flash/ap1_mod.swf',
wmode: "transparent",
allowfullscreen: "true"
};
swfobject.embedSWF("/public/flash/ap1_mod.swf", "ap1_mod", "400", "50", "9.0.0", false, flashvars, params);
</script>
This is not working and I get a JS error saying that playSongJS is not defined.
I don't know what could be wrong and I've already wasted too much time on this. Any help would be greatly appreciated
Read more...
Source: Stack Overflow