ExternalInterface.call 在 IE 中导致错误

发布于 2024-07-20 12:50:43 字数 820 浏览 4 评论 0原文

我有一个菜单屏幕,由于各种原因,它由许多按钮组成,作为单独的 Flash 电影。 当点击这些电影中的按钮时,它应该调用 JavaScript 函数来移动到适当的页面。 它在 Firefox 中运行良好,但目前在 IE7 中失败。 我没有方便测试的 IE6。 这是我在 IE 中遇到的错误:

Line:1
Char:25
Error: Expected ';'
Code:0

我无法找到第 1 行的 char 25 的实际含义。 我仅在单击按钮时收到错误,并且在安装 Visual Web Developer 尝试进行一些实际调试后,它似乎并没有真正触发所调用的函数,因此似乎错误发生在什么机制实际上使ExternalInterface.call起作用?

Flash 电影上的代码实际上就是:

ExternalInterface.call('gohere',skip_id);

其中skip_id 作为 flashvar 传递到电影中 - 它似乎获得了一个有意义的值,因为我可以将其打印到 Flash 电影内的文本字段。 javascript 函数同样复杂:

function gohere(i){
    lo.skipto(i);
}

但正如我所说,如果我在这里放置断点并调试它,它甚至不会显示。 如果我在 html 屏幕中放置一个 javascript:gohere('id') 链接并单击它,它就可以正常工作。 我有ExternalInterface.call在同一项目的其他部分工作,并且我一生都看不到它的实现方式有任何差异。

有想法吗?

I have a menu screen that for various reasons consists of a number of buttons as separate flash movies. When a button inside these movies is clicked, it is supposed to call a javascript function to move to the appropriate page. It works fine in firefox, but is currently failing in IE7. I don't have an IE6 handy to test on.
This is the error I get in IE:

Line:1
Char:25
Error: Expected ';'
Code:0

I can't locate what char 25 of line 1 might actually mean. I only get the error when I click on the button, and after installing Visual Web Developer to try and get some actual debugging, it doesn't seem to be actually firing the function that is called, so it seems like the error is happening in whatever mechanism actually makes ExternalInterface.call work?

The code on the flash movie is literally just:

ExternalInterface.call('gohere',skip_id);

Where skip_id is passed into the movie as a flashvar - it seems to get a sensical value as I can print it to a textfield inside the flash movie. The javascript function is equally complicated:

function gohere(i){
    lo.skipto(i);
}

But as i said it doesn't even show up if I put a breakpoint here and debug it. If I put a javascript:gohere('id') link in the html screen and click that it works fine.
I have ExternalInterface.call working in other parts of the same project, and can't for the life of me see any differences in the way it has been implemented.

Ideas?

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

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

发布评论

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

评论(2

故乡的云 2024-07-27 12:50:43

结果我在对象标签的 ID 中有一个 - ,IE 根本不喜欢这个。

叹息

Turns out I had a - in the ID of the object tag, which IE doesn't take kindly to at all.

sigh

谁的新欢旧爱 2024-07-27 12:50:43

我不擅长调试这类事情,在 IE 中更是如此,所以对于初学者,我会在我的 gohere 中放置一个“alert()”。 然后我会开始在我的javascript中输入回车符,看看有错误的行是否移动,并通过推导找出答案。

顺便说一句,有一个名为 IETester 的软件,它可以向您展示您的页面在 IE 5.5/6/7/8RC1 中的外观。

I'm terrible at debugging these sorts of things even more so in IE, so for starters I would put an "alert()" in my gohere. Then I would start putting carriage returns in my javascript, and see if the line with the error moves, and figure it out by deduction.

as an aside, there is a piece of software called IETester, which should show you what your page would look like in IE 5.5/6/7/8RC1.

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