外部接口:无法从回调访问某些 AS 对象(影片剪辑)
基本上,我的 as 文件中有一些函数。他们中的一些人使用 mc 实例。当调用使用它作为回调的函数时,该实例不可用。有办法解决吗?
例子。
AS
function B(){
ExternalInterface.call('console.log','ok')//OK!!!
}
//italy is a MovieClip on the Main timeline
function A(){
B();
ExternalInterface.call('console.log',italy)//Error!
}
ExternalInterface.addCallback('test',A);
JS
$('flash').test();//flash is my html swf object
我尝试从 javascript 调用的 A(仅)引用意大利的错误:
未捕获的异常:Actionscript 中的错误。
基本上,意大利影片剪辑可以通过 AS 功能获得。但如果我从 javascript 调用 AS 函数,则它不可用。正如你所看到的,我从 A 看到了 B。我只看不到意大利。为什么?
basically, I have some functions in my as file. Some of them play with a mc instance. The instance is not available when calling the function that uses it as callback. Is there a way to solve?
Example.
AS
function B(){
ExternalInterface.call('console.log','ok')//OK!!!
}
//italy is a MovieClip on the Main timeline
function A(){
B();
ExternalInterface.call('console.log',italy)//Error!
}
ExternalInterface.addCallback('test',A);
JS
$('flash').test();//flash is my html swf object
The error I get trying to reference italy from A (only) whem called from javascript:
uncaught exception: Error in Actionscript.
Basically, the italy movieclip is available through the AS functions. But it isn't available if I call an AS function from javascript. As you can see though, I see B from A. It's only Italy that I can't see. why?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嘿,不,一切都好,它有效。这是我的一种方法中的一个严重错误。
对不起。也许版主可以删除这个问题。再见!
Hey, no, it's all ok, it works. It was a bad error inside one of my methods.
Sorry. Maybe moderators could delete this question. Bye!