I'm trying to pass data from Flash to Javascript via ExternalInterface.
It works fine when I'm testing on my localhost, but when I tried to set a website at IIS, so my coworkers could test my application, like: http://192.168.0.10/MyApp, I getting this error:
Error calling method on NPObject.
After reading some questions at Stackoverflow I tried to set allowScriptAccess="always" at my embed tags and Security.allowDomain(*) at my AS file, but it still doesn't work.
I'm using swf object if that matters.
What am I missing?
EDIT: The error occurs when I try to call a method from js to my swf. This is the code adapted to the answer bellow.
var swfReady = false;
swfobject.embedSWF("swf/1.swf", "flashContent", "300", "250", "11", "expressInstall.swf", null, { allowScriptAccess: "always" } , null, function (e) {
if (e.success) {
setTimeout(function () {
swfReady = true;
}, 150);
}
});
btnConfig.on('click', function () {
if (swfReady) {
flashContent.myMethod();
} else {
alert("Hold on...");
}
});
This works great at localhost but when someone try to view the same page through my IP, I get the Javascript error Error calling method on NPObject.
Security.allowDomain("*");before yourExternalInterfacecall - Pranav Hosangadi