These two for loops that I'm going to use 1 to score points and 1 to remove lives, are causing an AS3 error #1010, "A term is undefined and has no properties" however I define both arrays in my constructor code and define the for loop variable in the for loop. It also doesn't make it into the second for loop despite doing things that come after it in the main function. Any help?
for (var iPlus = 0; iPlus <= objectArrayPlus.length; iPlus++)
{
if (objectArrayPlus[iPlus].y >= 400)
{
removeChild(objectArrayPlus[iPlus]);
objectArrayPlus.splice(iPlus, 1);
}
else if (gameBoat.hitTestObject(objectArrayPlus[iPlus]))
{
trace("this will score");
}
}
for (var iMinus:int = 0; iMinus <= objectArrayMinus.length; iMinus++)
{
trace ("for loop entered");
if (objectArrayMinus[iMinus].y >= 150)
{
removeChild(objectArrayMinus[iMinus]);
objectArrayMinus.splice(iMinus, 1);
}
}