when I try and run, I get this error:
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
at this line:
which is in this function:
in my other class, I call isKeyPressed from this:
[Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.
at this line:
Code: Select all
return (keyState[k] == 1);
which is in this function:
Code: Select all
static public function isKeyPressed(k:int):Boolean{
timeSinceLastKey = 0;
return (keyState[k] == 1);
}
in my other class, I call isKeyPressed from this:
Code: Select all
public function MouseDestroy():void{
// mouse press
if (!Input.mouseDown && Input.isKeyPressed(68/*D*/)){
var body:b2Body = GetBodyAtMouse(true);
if (body)
{
world.DestroyBody(body);
return;
}
}
}