ActionScript 2 中缺少ExternalInterface.objectID 是否有解决方法

发布于 2024-07-13 06:44:50 字数 576 浏览 4 评论 0原文

我将一些 ActionScript 3 向下移植到 ActionScript 2(遗憾的是,一些广告代理商仍然拒绝拥抱未来),并且我遇到了 ActionScript 2 ExternalInterface 中没有 objectID 的问题code> 属性,就像在 ActionScript 3 中一样。

我正在处理的代码调用了大量 JavaScript,其中一些代码要求脚本知道 Flash 对象/嵌入的 ID(例如,查找 Flash 对象/嵌入的 ID)页面,并调整对象/嵌入的大小)。

是否有一个简单的解决方法来获取 ActionScript 2 中的对象/嵌入 ID?

我已经设法编写了一些 JavaScript 代码,基本上搜索页面上的所有对象和嵌入节点,直到找到具有特殊方法的对象(使用 ExternalInterface.addCallback 设置),并且通过这种方式设法将 ID 放入ActionScript 环境,但感觉像是一种老套且不安全的方法。 当然有更简单的方法吗?

编辑:我无法控制嵌入 SWF 的代码,因此传递 ID 不起作用。

I'm downporting some ActionScript 3 to ActionScript 2 (some ad agencies sadly still refuse to embrace the future) and I've run into the issue that in ActionScript 2 ExternalInterface has no objectID property, as it does in ActionScript 3.

The code I'm working on calls a lot of JavaScript, and some of that code requires the script to know the ID of the Flash object/embed (for example to find the position on the page, and to resize the object/embed).

Is there a simple workaround to get hold of the object/embed ID in ActionScript 2?

I have managed to write some JavaScript code that basically searches all object and embed nodes on the page until it finds one with a special method (set with ExternalInterface.addCallback) and that way managed to get the ID into the ActionScript environment, but it feels like a hacky and unsafe method to rely on. Surely there is a simpler way?

Edit: I don't have control over the code that embeds the SWF, so passing in the ID doesn't work.

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

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

发布评论

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

评论(3

面犯桃花 2024-07-20 06:44:50

这是您要找的吗?
简单的actionscript 2类,发现它拥有flash html对象id。

http://sourceblogg .se/lang/en/mina-projekt/isitme-get-flash-html-object-id-within-flash/

Is this what you looking for?
Simple actionscript 2 class that find it owns flash html object id.

http://sourceblogg.se/lang/en/mina-projekt/isitme-get-flash-html-object-id-within-flash/

夕嗳→ 2024-07-20 06:44:50

通过 FlashVars 将 ID 传递给 SWF 怎么样? 嵌入时您应该知道 ID,因此应该很容易将其添加为传递给 Flash 的 FlashVars 变量之一。 然后将其存储在调用ExternalInterface的代码可以访问的地方。

What about passing the ID to the SWF via FlashVars? You should know the ID when you embed it, so it should be easy enough to add it as one of the FlashVars variables passed to Flash. Then store that somewhere your code that calls ExternalInterface can get at it.

玻璃人 2024-07-20 06:44:50

尝试 Flash Javascript 集成工具包 http://weblogs.macromedia.com/flashjavascript/
据我所知,AS3 中的ExternalInterface 类是该AS2 解决方案的形式化形式。

Try the Flash Javascript Integration kit http://weblogs.macromedia.com/flashjavascript/ .
As far as I'm aware, the ExternalInterface class in AS3 was a formalisation of this AS2 solution.

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