I have trouble with my ActionScript 3 code, it gives me this error :
TypeError: Error #2007: Parameter hitTestObject must be non-null. at flash.display::DisplayObject/_hitTest() at flash.display::DisplayObject/hitTestObject() at MethodInfo-8()
This is the code:
//Kills you if you touch an Enemy
addEventListener(Event.ENTER_FRAME, checkCollision);
function checkCollision(e:Event):void
{
if (square.hitTestObject(newEnemy)){
//removeEventListener(Event.ENTER_FRAME, checkCollision);
removeEventListener(Event.ENTER_FRAME,update);
stage.removeEventListener(KeyboardEvent.KEY_DOWN,jump);
removeChild(square);
init();
}
}
newEnemy
shouldn't be null ... - akmozo