Error Calling Method On Npobject Externalinterface.addcallback
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Cross Domain ExternalInterface “Error calling method on NPObject” up vote 19 down vote favorite 8 I am trying to enable communication between Javascript and Flash via ExternalInterface across domains. The Javascript works great when it is located on the same domain as the SWF. But in one case, the HTML resides on domain A, the javascript and the flash both reside on domain B. I have done all of the following: The embed tag has allowScriptAccess="always" (and the object has that as a param) My SWF file's actionscipt has Security.allowDomain("*") My SWF also calls Security.allowInsecureDomain("*") Both domain A and domain B have a /crossdomain.xml file which has allow-access-from domain="*" The SWF is able to call javascript on the page, but when I use Javascript to call functions exposed by ExternalInterface, I get Error calling method on NPObject! [plugin exception: Error in Actionscript. Use a try/catch block to find error.] This is ActionScript 2 so ExternalInterface.marshallExceptions is not available. javascript flash actionscript-2 externalinterface share|improve this question edited May 24 '12 at 15:50 lord_t 1,92921536 asked Jun 24 '09 at 14:17 Josh 8,39274489 Are you loading up more than one swf? Or is a swf on domain A (with the HTML) loading up your swf on domain B? –Alex Jillard Jun 24 '09 at 18:10 Alex -- Good point, I didn't mention that. The javascript from domain B loads a SWF from domain B, and that SWF loads a second SWF from domain B. This loading seems to work but I can't be sure because I can't interact with the SWF. –Josh Jun 24 '09 at 18:14 add a comment| 6 Answers 6 active oldest votes up vote 20 down vote accepted You should only need two things for this to work: 1) allowscriptaccess=always will allow your swf to send stuff out to the page 2) System.security.allowDomain("yourhtmldomain.com"); Note that it's System.security.allowDomain() in AS2 - it's not the same as AS3 or what you have written above. number
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is http://stackoverflow.com/questions/1038668/cross-domain-externalinterface-error-calling-method-on-npobject a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Calling an AS function with ExternalInterface.call() injected JS up vote 1 down vote favorite How do I call a function in ActionScript 3 from JavaScript that has been injected into the page http://stackoverflow.com/questions/13630297/calling-an-as-function-with-externalinterface-call-injected-js using ExternalInterface.call()? I've tried this a bunch of ways, to no avail. Here is a simplified version of all the necessary code: public function myClass() { ExternalInterface.addCallback("callASFunction", myASFunction); var loadJS:XML = script // Inject the JS into the page ExternalInterface.call(loadJS, ExternalInterface.objectID); } public function myASFunction(vars:String){ // Do great things } Comments The line marked with <= ERROR throws the following in Chrome: Uncaught Error: Error calling method on NPObject. And in FF: uncaught exception: Error in Actionscript. Use a try/catch block to find error. I believe that the issue is that the ExternalInterface.addCallback() is not attaching a listener on the Flash object before the ob.callASFunction() is called. Or, perhaps I'm missing something. Any pointers would be much appreciated. javascript a
object (via jQuery.parseJSON). javascript - Cross Domain ExternalInterface "Error calling method on https://recalll.co/app/?q=javascript%20-%20Cross%20Domain%20ExternalInterface%20%22Error%20calling%20method%20on%20NPObject%22 N... View More at http://stackoverflow.com/questions/1038668/cross-domain-externali... Since you are loading multiple swfs, you may need to include the security settings in each of those swfs on domain B that http://flash.bigresource.com/javascript-Error-calling-method-on-NPObject-9oo8obRnk.html are loaded. You may also need a loader context with the appropriate security settings. import flash.system.LoaderContext; import flash.system.ApplicationDomain; import flash.system.Security; import flash.system.SecurityDomain; import flash.net.URLRequest; import flash.net.URLLoader; var context:LoaderContext error calling = new LoaderContext(true, ApplicationDomain.currentDomain, (Security.sandboxType == Security.REMOTE) ? SecurityDomain.currentDomain : null); var l:Loader = new Loader(); l.load(new URLRequest("http://example.com/myswf.swf"), context); Hi, I have the same problem, whenever I tried to enter something other than NULL in security domain I get a Error: Error #2114: Parameter LoaderContext.securityDomain must be null. Any suggestions? javascript - Cross Domain ExternalInterface "Error error calling method calling method on N... View More at http://stackoverflow.com/questions/1038668/cross-domain-externali... for me a few reason was (i'm using uploadify): solution: object tag in html must have allowScriptAccess="always" it can be done by set param like $('#file_upload').uploadifySettings('scriptAccess', 'always') than flash object must have: import flash.system.Security; Security.allowDomain('remotedomain.com'); it can be done by compile source with this param, i have that, if you need it write to me with uploadify subject. Than Remote server, where flash include in the page, must have in the root crossdamoin.xml file with content like: javascript - Cross Domain ExternalInterface "Error calling method on N... View More at http://stackoverflow.com/questions/1038668/cross-domain-externali... ExternalInterface.addCallback() javascript - Cross Domain ExternalInterface "Error calling method on N... View More at http://stackoverflow.com/questions/1038668/cross-domain-externali... In my case, it was because I was modifying the DOM element containing the uploader div. I used the jquery hide() function to hide the div containing the uploader, and when I realized that caused the above error, I tried a different approach where I s
we're just experimenting with external interface. Right now i just have a flash object and 3 buttons each to play pause and load a video. The only button that is currently set up to do anything is the load button. My swf and my html file sit on the same file system, and my video files sit on another server with traffic being redirected through a media server.When i press the load button, which should just give it the path of the video file on it's server. Instead it throws an error that reads "Error: Error Calling method on NPObject". [code]I've read in a lot of places that this is an issue with security, but both my swf and html are in the same folder on my local machine. Only the files come from outside, and in any case I think i've set the security settings correctly when i declare my flash player in the object tag, but maybe i'm missing something there.if you can't solve my question directly can someone please explain what "error calling method on NPObject" means? I'm sure its specific to flash-js communications because i've never seen it before and that's what i have gathered from my googling. View 2 Replies Similar Posts: Javascript :: Google Visualization API - Error Calling Method On NPObject? Apr 18, 2011 I've been playing with the visualization API aka dynamic charts and I've found that the example at [URL] does not really work on localhost. That is, Error calling method on NPObject is thrown when a event is clicked (points A and B in the example aforementioned). I suppose that is a security issue on the server end (Google's flash base).Since that jsFiddle code is hosted on a domain, the note at the very bottom of the documentation should not apply:Because of Flash security settings, this (and all Flash-based visualizations) might not work correctly when accessed from a file location in the browser [URL] rather than from a web server URL [URL] . View 2 Replies Javascript :: Overcome "Error Calling Method On NPObject" And Play() A SWF? Apr 9, 2011 I am working on a quiz system. Normally it uses jpeg images with each question. But a few of the quizzes instead feature animated .SWF files. I want to use jquery swfobject to