as2中的flash外部ExternalInterface调用

发布于 2024-08-19 03:49:21 字数 551 浏览 2 评论 0原文

我有一个外部接口调用,它应该从嵌入 swf 的 html 中检索一些文本。

var name:Object = flash.external.ExternalInterface.call(
    "function(){return JSObject.get('Resource', 'name');}");

当我将变量名称放入文本框中时,我得到了正确的文本。

当我将 geturl 与 clickTag 一起使用时,在某些情况下它可以工作(未编码的 clickTag url)。有时它是未定义的(编码的 clickTag url)。如果我使用 name.toString 那么它会打开 http://www.someurl.com/[type%20Function] 或显示 [type%20Function] 在文本框中。

所以我怀疑在传递 clickTag url 时遇到编码问题。我的问题是,如何将此对象转换为字符串或将对象的内容分配给字符串变量以避免这一切?

谢谢

I have an external interface call which should retrieve some text from the html that the swf is embedded in.

var name:Object = flash.external.ExternalInterface.call(
    "function(){return JSObject.get('Resource', 'name');}");

When I put the variable name into a textbox I get the correct text.

when I use geturl with a clickTag, under some circumstances it works (unencoded clickTag url). Sometimes it's undefined (encoded clickTag urls). If I use name.toString then it opens http://www.someurl.com/[type%20Function] or displays [type%20Function] in a textbox.

So I suspect that I'm having encoding issues when passing on the clickTag url. My question is, how do I convert this object to a string or assign the contents of the object to a string variable to avoid all this?

Thanks

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

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

发布评论

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

评论(1

小梨窩很甜 2024-08-26 03:49:21

如果您使用 name.toString ,您将引用函数定义,这就是您获得 [type%20Function] 的原因。使用 name.toString() 代替

if you use name.toString you are referring to the function definition, that's why you're getting [type%20Function]. use name.toString() instead

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