ExternalInterface.call在IE中导致错误

时间:2021-06-27 18:58:16

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:

我有一个菜单屏幕,由于各种原因包括许多按钮作为单独的闪光电影。当单击这些电影中的按钮时,应该调用javascript函数移动到适当的页面。它在firefox中工作正常,但目前在IE7中失败了。我没有IE6方便测试。这是我在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?

我找不到第1行的char 25实际意味着什么。我只是在单击按钮时遇到错误,并且在安装Visual Web Developer以尝试进行实际调试之后,它似乎并没有实际触发调用的函数,因此看起来错误发生在什么机制实际上使ExternalInterface.call工作?

The code on the flash movie is literally just:

flash电影上的代码就是:

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:

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

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.

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

Ideas?

2 个解决方案

#1


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

事实证明我有一个 - 在对象标签的ID中,IE根本不需要它。

sigh

#2


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.

我在IE中调试这些东西时非常糟糕,所以对于初学者来说,我会在我的遗嘱中加上“警报()”。然后我会开始在我的javascript中放回车,并查看带错误的行是否移动,并通过扣除来计算出来。

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.

另外,还有一个名为IETester的软件,它可以显示你的页面在IE 5.5 / 6/7 / 8RC1中的样子。

#1


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

事实证明我有一个 - 在对象标签的ID中,IE根本不需要它。

sigh

#2


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.

我在IE中调试这些东西时非常糟糕,所以对于初学者来说,我会在我的遗嘱中加上“警报()”。然后我会开始在我的javascript中放回车,并查看带错误的行是否移动,并通过扣除来计算出来。

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.

另外,还有一个名为IETester的软件,它可以显示你的页面在IE 5.5 / 6/7 / 8RC1中的样子。