UPDATE:
To fix the issue I discussed some days ago(see below) use:
System.security.allowDomain(”http://ip-adress”);
ip-adress is the IP you are developing on! This will fix the security issues!
While trying to let Actionscript talk to Javascript using the External Interface API of Actionscript I bounced upon a problem when Actionscript tried to invoke this Javascript function. In Firefox 2.0.0.2 an alert message shouted to me: “Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.].”.
My precise environment was, the html running on the localhost (Rails application) and the swf from an other domain and this seemed to be the problem. When I deployed the Rails application to this server, there was no problem at all invoking these functions. It looks like a bug in the flash player, cause I tried all the security settings possible in flash, the famous crossdomain.xml, adding all locations to the flash settings but no result. Somehow the SWF from that other domain had some troubles talking to the local javascript.
My way to solve this issue was to load the SWF also from the localhost. Everything works perfectly and I can continue testing.
Tags: crossdomain, Flash, security



May 23rd, 2007 at 9:55 pm
Sweet thanks, didn’t think of that
September 19th, 2007 at 4:37 am
Joebert from ozzu.com suggests changing your javascript function that detects the Flash Player type to:
function getSWF(movieName) {
if (navigator.appName.indexOf(”Microsoft”) != -1) {
return window[movieName];
}
else {
if(document[movieName].length != undefined){
return document[movieName][1];
}
return document[movieName];
}
}
http://www.ozzu.com/ftopic74795.html
September 19th, 2007 at 9:29 pm
mcbk, thanks for your reply, this can help for some people. but our problem was about the different domains the swf and javascript were on. The system.allowdomain(’*') will still solve those problems as I think.
December 21st, 2008 at 10:48 pm
Hi,
Your solution makes sense. But there’s still a problem. Of using 3th part SWF that you cannot alter. It’s kind of sad to know that the only solution is to change the SWF. I know that you can decompile it. But I’m not a very good Flash developer and I really had problems trying to decompile, modify and recompile a particular SWF. I’ll try to contact the developer to help me with that.
Thank you.
January 7th, 2009 at 4:53 am
Hi, Jaap
I’ve also met this problem only in ff2.0.2.
But it is more strange like this scenario:
when AS call JS function, i.e. ExternalInterface.call(foo…);
That is ok.
However when JS call AS function, this issue will occur.
Your solution seems not to help me. Waiting for your update, thanks!
January 7th, 2009 at 4:54 am
sorry, it’s in firefox 2.0.0.20
January 9th, 2009 at 8:39 am
Hi,
I have a very painful cross domain scripting problem. I’ve tested every crazy thing to fix it and nothing really works. Please see http://flashpanoramas.com/forum/showthread.php?t=2001 where I’ve described my issue. Any help or idea would be highly appreciated.
Best regards,
Gabi