actionscriptExternalInterface命名空间冲突

发布于 2024-07-13 04:19:00 字数 435 浏览 4 评论 0原文

A 有一个 flash 小部件(音乐播放器),一个页面上大约有 10 个它的实例。 我需要在 Flash 和它嵌入的页面的 javascript 之间进行通信。很长一段时间以来我没有对 ActionScript 做太多事情,但是一些谷歌搜索引导我 此处,以及外部接口。 看起来很完美,但有一个问题。 我做了这样的事情:

ExternalInterface.addCallback("stopTrack", this, stopTrack);

但是,现在 stopTrack 将被注册到页面上的 10 个不同的东西。 我希望能够仅停止 10 个轨道中的一个。

A have a flash widget (a music player) and there are about 10 instances of it on one page. I need to communicate between the flash and the javascript of the page it's embedded in. I haven't done much with actionscript for a long time, but some googling led me here, and to ExternalInterface. It seemed perfect, however there is one problem. I did something like this:

ExternalInterface.addCallback("stopTrack", this, stopTrack);

However, now stopTrack will be registered to 10 different things on the page. I want to be able to stop just one of the 10 tracks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

天暗了我发光 2024-07-20 04:19:01

我不完全记得 - 但我似乎认为回调没有添加到窗口对象,而是添加到页面上的 swf 对象 - 所以类似的东西

document.getElementById('musicFlashPlayer10').stopTrack();

只会在该实例上触发回调。

此格式可能会在浏览器之间发生变化 - 在任何情况下,回调都会添加到为其加载 Flash 文件的每个 javascript 实例中。

I don't ENTIRELY remember -- but I seem to think that the callback isn't added to the window object, but the swf object on the page -- so somthing like

document.getElementById('musicFlashPlayer10').stopTrack();

would fire the callback on only that instance.

This format might change between browsers - in any case, the callback is added to each javascript instance the flash file is loaded for.

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