ActionScript 错误 - 1086:左大括号前需要有分号吗?
我正处于创建自己的在线多人问答游戏的最初阶段,我正在做这个教程 当我在与第一帧和动态文本字段关联的动作脚本中遇到编译错误(标题中)时:
onClipEvent (load) {
loadVariables("http://localhost/read.php?file=testfile", this, "GET");
}
我不确定我做错了什么?使用Flash CS5...这段代码是否不兼容CS3之类的?任何帮助将不胜感激,我一个小时以来一直在努力找出我做错了什么! :)
谢谢!
I am in the very beginning stages of creating my own online multiplayer trivia game and I was doing this tutorial when I ran into a compile error (in title) in the actionscript associated with the 1st frame and the dynamic text field:
onClipEvent (load) {
loadVariables("http://localhost/read.php?file=testfile", this, "GET");
}
I am not sure what I am doing wrong? Using Flash CS5...is this code not compatible for CS3 or something? Any help would be appreciated, I have been trying to find out what I am doing wrong for like an hour! :)
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您的主要问题是您正在编写 Actionscript 2,而您的项目很可能设置为 Actionscript 3。onClipEvent 是 Actionscript 1 的旧遗产,因此该教程充其量已经过时了。
您的加载代码(在 AS3 中)应该看起来更像这样:
Your main problem is that you are coding Actionscript 2 while your project is very likely set to be Actionscript 3.
onClipEvent
is an old heritage from Actionscript 1, so, that tutorial is outdated at best.Your loading code (in AS3) should look more like this:
我不熟悉 Flash,但作为 Flex 开发人员,我猜测您的代码是函数声明(事件处理程序)。在严格的 ActionScript 中,您可以这样声明它:
I'm not familiar with Flash, but as a Flex developer I would guess that your code is a function declaration (event handler). In strict ActionScript you would declare it like this:
嗯,看起来那个教程有一些错误,因为我认为你想写“function onClipEvent(load)”,我很惊讶建议的修复启动没有改变任何东西,要么修复问题,要么至少生成一个不同的错误。您绝对确定您使用更改后的代码运行了它吗?
该错误的另一个可能原因(实际上是大多数语法错误)是之前的代码中的错误,因此我们可能需要您发布更多代码,然后仅发布该函数。括号错误通常是由于未正确关闭前一个代码块引起的(例如,在粘贴新代码时意外删除括号):
hm it looks like that tutorial has some mistakes, because I think you want to write "function onClipEvent(load)" I'm surprised the fix splash suggested didn't change anything, either fixing things or at least generating a different error. Are you absolutely sure you ran it with the changed code?
Another probable cause for that error (most syntax errors actually) is a mistake in the code before it so we may need you to post more of your code then just that one function. Errors with brackets are often caused by not properly closing the previous code block (eg. accidentally deleting a bracket while pasting in new code):
我认为您在这些行之前做错了一些事情,可能缺少 ;
只是为了测试,将其写为
“也分享上面的行”
希望有效
I think you are doing some thing wrong before these lines, may be ; is missing
just for test write it as
Also share above lines
hopes that works