如何公开嵌入式 Flash 对象的 JavaScript 接口?

发布于 2024-10-05 09:40:49 字数 233 浏览 0 评论 0原文

JavaScript 和Flash Player 可以通过Flash 的ExternalInterface 机制交换数据:您注册希望能够从JavaScript 调用的ActionScript 函数。

我的问题:如何找出 Flash 对象的哪些 ActionScript 函数可供我从 JavaScript 调用(假设它们没有记录)?

有没有一种编程方法可以在 JavaScript 中做到这一点?

谢谢!

JavaScript and the Flash Player can exchange data via Flash's ExternalInterface mechanism: you register ActionScript functions that you would like to be able to be called from JavaScript.

My question: How can I figure out what ActionScript functions of a Flash object are available for me to call from JavaScript (assuming they are not documented)?

Is there a programatic way to do this in JavaScript?

Thanks!

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

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

发布评论

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

评论(1

樱娆 2024-10-12 09:40:49

你不能直接枚举它们(它们不会在 for..in 循环中列出),但你可以显式地测试每一个......

var swf = document.getElementById('theID');
alert('someMethod' in swf);  // will alert true if 'someMethod' is exposed via ExternalInterface.addCallback

如果在 $(document).ready 或 window.onload 期间调用,这可能会失败- swiff 必须“初始化”(加载和注册)才能使公开的方法可用。

you can't enumerate them directly (they won't be listed in a for..in loop), but you can test for each one explicitly...

var swf = document.getElementById('theID');
alert('someMethod' in swf);  // will alert true if 'someMethod' is exposed via ExternalInterface.addCallback

this might fail if called during $(document).ready or window.onload - the swiff must be 'initialized' (loaded and registered) for the exposed methods to be available at all.

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