1009 null object reference
Hi, I'm creating an android game and everything goes wrong when you lose and the "lose screen" is displayed...
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at rock/destroyEnemy()
at Function/main/$construct/endGame()
at Function/main/$construct/Loop()
(this is in the main class file)
for each (var enemy:rock in aEnemyArray)
{
//destroy enemy in loop
enemy.destroyEnemyAgain();
//remove enemy from array
aEnemyArray.splice(0, 1);
}
(this is in the enemy class file)
public function destroyEnemy():void
{
parent.removeChild(this)
removeEventListener(Event.ENTER_FRAME, enemyLoop);
}
The thing is that if you don't shot at he rocks there´s no problem, but when you hit one, at the time you lose, the error comes.
Thanks.
