actionscriptExternalInterface命名空间冲突
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不完全记得 - 但我似乎认为回调没有添加到窗口对象,而是添加到页面上的 swf 对象 - 所以类似的东西
只会在该实例上触发回调。
此格式可能会在浏览器之间发生变化 - 在任何情况下,回调都会添加到为其加载 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
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.