外部接口:无法从回调访问某些 AS 对象(影片剪辑)

发布于 2024-10-06 05:00:24 字数 588 浏览 0 评论 0原文

基本上,我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抱着落日 2024-10-13 05:00:24

嘿,不,一切都好,它有效。这是我的一种方法中的一个严重错误。

对不起。也许版主可以删除这个问题。再见!

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!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文