本文介绍了错误1010在ActionScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编译和运行我的程序后,我碰到运行时错误1010:
After compiling and running my program, i run into runtime error 1010:
TypeError: Error #1010: A term is undefined and has no properties.
at DC/updateScore()[DC::frame74:36]
这是一张code:
function updateScore(e:MouseEvent) {
var i:uint=0;
for(;i<balls.length;i++)
if(balls[i]==e.target)
break;
if(balls[i].isCorrect) {
score++;
timeField.text = new String(score);
}
else {
score--;
timeField.text = new String(score);
}
}
这是什么问题?我使用updateScore功能的MouseEvent侦听器,你可以看到。
What's the problem? I'm using updateScore function for MouseEvent listener, as you can see.
推荐答案
请把{和}到你的for循环!
Please put { and } to your for loop!
function updateScore(e:MouseEvent) {
var i:uint=0;
for(;i<balls.length;i++) {
if(balls[i]==e.target)
break;
if(balls[i].isCorrect) {
score++;
timeField.text = new String(score);
}
else {
score--;
timeField.text = new String(score);
}
}
}
它允许不使用{和}一个循环,但那么只有第一条语句将excuted。
Its allowed not to use { and } with a loop but then only the first statement will be excuted.
这篇关于错误1010在ActionScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!