hitTestObject undefined property
Hello. i am making a game, it involes shooting targets. the way it works is i have a small dot (one pixel) and, when a mouse button is clicked, checks to see if its hitting a target.
in my target.as file i have the following error:
Line 23 1120: Access of undefined property poi.
poi is the instance name of thing that checks to see if its hitting the target. (point of impact)
if (target.hitTestObject(poi))
thats the code giving the error.
public function Target()
{
this.addEventListener(MouseEvent.CLICK, detectCollision);
//on mouseclick see if POI (point of impact) is over the target
function detectCollision()
{
if (target.hitTestObject(poi))
{
removeChild(target);
//remove the target, tell kongregate a target was hit
kongregate.stats.submit("TargetHit",1);
//there is no target onstage
var targetAlive = 0;
}
}
thats the code surrounding it.
thanks for helping