2012 年 9 月 20 日,格林威治标准时间 + 8 点晚上 7:27.. 即使使用代码“继续;”仍然有同样的错误......还有其他建议吗?:(
帮助以前的答案仍然无效.. :(
练习教程。当对象 git 捕手时,我的这部分代码出现错误。
function moveObject(e:Event):void {
// cycle thru objects using a for loop
for (var i:int=objects.length-1; i>=0; i--) {
//move objects down based on speed
objects[i].y += speed;
objects[i].rotation += speed;
// if objects leaves the stage
if (objects[i].y > 400) {
// remove it from display list
removeChild(objects[i]);
// remove it from the array backwards
// remove it backwards removes all problems when looping through.
// forward would cause confusion if you removed 5 before 4.
objects.splice(i, 1);
}
if (objects[i].hitTestObject(player.arrowS.sackC)) {
if (objects[i].typestr == "good") {
score += 3;
} else {
score -= 5;
if (score <= 0) {
score = 0;
}
}
trace(score);
updateScore(score);
removeChild(objects[i]);
objects.splice(i, 1);
}
}
}
尽管游戏仍在运行,但看到这一点很烦人。这是错误
TypeError: Error #2007: Parameter hitTestObject must be non-null.
at flash.display::DisplayObject/flash.display:DisplayObject::_hitTest()
at flash.display::DisplayObject/hitTestObject()
at adventure_fla::MainTimeline/moveObject()