bwilson
09-02-2009, 03:36 PM
I'm calling an ActionScript function in my flash movie from JavaScript...it's defined in ExternalInterface as a callback. This works fine in IE on Windows and in FireFox on Windows and Mac. Does not work in Safari or Opera on Mac, however.
Below is the Javascript that I'm using to invoke the ActionScript function; I got this from the Adobe documentation for ExternalInterface. Running this code in Safari or Opera, the "Can't find application" alert is displayed.
Anyone know what DOM object to look in for the instance of the Flash movie for Safari and Opera?
BTW, I'm using SWFObject 2 to manage the flash movie, both the id and name of the nested "object" tags are set to "flashContent"...
swfobject.registerObject("flashContent", "9.0.0");
function findFlashApp(appname) {
if ( navigator.appName.indexOf('Microsoft') != -1 ) {
// MSIE
return window[appname];
} else {
// FireFox - not Safari or Opera?
return document[appname];
}
}
function clickIpAddress(ipaddr) {
var app = findFlashApp('flashContent');
if ( app == null ) {
alert("clickIpAddress(): can't find application");
return;
}
if ( app.submitIpAddress != null ) {
app.submitIpAddress(ipaddr);
} else {
alert("clickIpAddress(): can't find interface function submitIpAddress()");
}
}
Below is the Javascript that I'm using to invoke the ActionScript function; I got this from the Adobe documentation for ExternalInterface. Running this code in Safari or Opera, the "Can't find application" alert is displayed.
Anyone know what DOM object to look in for the instance of the Flash movie for Safari and Opera?
BTW, I'm using SWFObject 2 to manage the flash movie, both the id and name of the nested "object" tags are set to "flashContent"...
swfobject.registerObject("flashContent", "9.0.0");
function findFlashApp(appname) {
if ( navigator.appName.indexOf('Microsoft') != -1 ) {
// MSIE
return window[appname];
} else {
// FireFox - not Safari or Opera?
return document[appname];
}
}
function clickIpAddress(ipaddr) {
var app = findFlashApp('flashContent');
if ( app == null ) {
alert("clickIpAddress(): can't find application");
return;
}
if ( app.submitIpAddress != null ) {
app.submitIpAddress(ipaddr);
} else {
alert("clickIpAddress(): can't find interface function submitIpAddress()");
}
}