最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Javascript -> Flash throwing "Error calling method on NPObject" - Stack Overflow

programmeradmin1浏览0评论

I'm trying to call a Flash (AS3) function from Javascript. When the code runs, I get the error "Error: uncaught exception: Error calling method on NPObject!" From my day's worth of googling around, this seems to be be a security matter, and I've done everything I can find, but the error still comes up.

Some details:
* This happens with both Flash 9 and Flash 10 players.
* The swf is in the same domain as the php file that loads it and that contains the javascript that's trying to call the Flash function.
* I'm using sfwobject2.2 to load the swf file, like so:

var flashvars = {};
var params = {};
var params = {menu: false, bgcolor: "#ffffff", allowScriptAccess: "always"};
swfobject.embedSWF("/path/to/swf", "id", "480", "310", "9.0.0", null, flashvars, params, attributes);


My Flash movie is doing the allowDomain thing, correctly as far as I can tell:

Security.allowDomain("www.mydomain");

* I know that the ExternalInterface.addCallback is set up properly -- when I disable it, I get a "no such function" error instead of the NPObject complaint.

This is driving me completely crazy, and I just can't figure out how to correct it. Any advice out there?

I'm trying to call a Flash (AS3) function from Javascript. When the code runs, I get the error "Error: uncaught exception: Error calling method on NPObject!" From my day's worth of googling around, this seems to be be a security matter, and I've done everything I can find, but the error still comes up.

Some details:
* This happens with both Flash 9 and Flash 10 players.
* The swf is in the same domain as the php file that loads it and that contains the javascript that's trying to call the Flash function.
* I'm using sfwobject2.2 to load the swf file, like so:

var flashvars = {};
var params = {};
var params = {menu: false, bgcolor: "#ffffff", allowScriptAccess: "always"};
swfobject.embedSWF("/path/to/swf", "id", "480", "310", "9.0.0", null, flashvars, params, attributes);


My Flash movie is doing the allowDomain thing, correctly as far as I can tell:

Security.allowDomain("www.mydomain.com");

* I know that the ExternalInterface.addCallback is set up properly -- when I disable it, I get a "no such function" error instead of the NPObject complaint.

This is driving me completely crazy, and I just can't figure out how to correct it. Any advice out there?

Share Improve this question asked Sep 13, 2009 at 18:45 Jim MillerJim Miller 1
  • Did you ever find an answer? I have the same issue. – Brent Commented Oct 26, 2010 at 20:53
Add a comment  | 

2 Answers 2

Reset to default 10

The answer I found was that it throws that error for many reasons. Mine was that I was not sending in the correct number of arguments for the function it was calling.

I found that by installing the Debugging version of the flash player from Adobe's site, I'd get a dialog box with the actual flash exception in it instead of the NPObject error, so this might be a helpful first step in figuring out what's actually going on.

In my case it looks like somehow, there is an incorrect number of arguments getting passed, and I'm not sure how this is happening (intermittently), but that's for another question. :)

发布评论

评论列表(0)

  1. 暂无评论