Javascript - > Flash抛出“NPObject上的错误调用方法” [英] Javascript -> Flash throwing "Error calling method on NPObject"

查看:177
本文介绍了Javascript - > Flash抛出“NPObject上的错误调用方法”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从Javascript调用一个Flash(AS3)函数。代码运行时,出现错误错误:未捕获的异常:在NPObject上调用方法错误!从我这一天的搜索引擎的价值来看,这似乎是一个安全问题,我已经做了我能找到的所有事情,但错误仍然存​​在。

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.

一些详细信息:

* Flash 9和Flash 10播放器都会发生这种情况。

swf与加载它的php文件位于同一个域中,并且包含正在尝试的JavaScript调用Flash函数。

*我使用sfwobject2.2来加载swf文件,如下所示:



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);



我的Flash电影正在做的allowDomain的事情,正如据我所知:

Security.allowDomain(www.mydomain.com);



*我知道ExternalInterface.addCallback设置正确 - 当我禁用它,我得到一个没有这样的功能的错误的NPObject的投诉。


这使我完全疯狂,我只是无法弄清楚如何纠正它。任何意见吗?

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?

推荐答案

我发现的答案是,它会抛出错误的原因很多。我的是,我没有发送它正在调用的函数的正确数量的参数。

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.

这篇关于Javascript - > Flash抛出“NPObject上的错误调用方法”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆