# hitTestObject from within an animated MovieClip help!

**URL:** https://forum.kirupa.com/t/hittestobject-from-within-an-animated-movieclip-help/328262
**Category:** flash
**Created:** [May 1, 2012, 11:31pm UTC](https://forum.kirupa.com/t/hittestobject-from-within-an-animated-movieclip-help/328262 "2012-05-01T23:31:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![49th](https://avatars.discourse-cdn.com/v4/letter/4/a4c791/32.png) [@49th](https://forum.kirupa.com/u/49th)
#### Post date: [May 1, 2012, 11:31pm UTC](https://forum.kirupa.com/t/hittestobject-from-within-an-animated-movieclip-help/328262/1 "2012-05-01T23:31:26Z")

</div>

Hi, I am having some trouble performing a hit test in a frog game I am making.

When the UP key on the keyboard is pressed an animation in my ‘frog’ MovieClip plays of a frog jumping, and at frame 22 and 23 (the peak of it’s jump) a second nested MovieClip appears for those 2 frames with instance name ‘mouth’.

I am trying to hit test mouth against ‘fly’ which is found on the main timeline.

Here is the code which I can’t figure out:

```auto
stage.addEventListener(KeyboardEvent.KEY_DOWN, frogJump);function frogJump(event:KeyboardEvent)
{
 if(event.keyCode==38) 
 {
     frog.gotoAndPlay(2);
     if ((Object(this).frog.mouth).hitTestObject(fly)) {trace("FLY HIT")}
 }
}

```

I receive the following error when UP is pressed:  
TypeError: Error #1009: Cannot access a property or method of a null object reference.  
at FrogGame\_Game\_fla::MainTimeline/frogJump()

Thanks for the help.
