# Multiple hitTestObjects problem :(

**URL:** <https://forum.kirupa.com/t/multiple-hittestobjects-problem/305904>\
**Category:** Uncategorized\
**Created:** [March 5, 2010, 1:29pm UTC](https://forum.kirupa.com/t/multiple-hittestobjects-problem/305904 "2010-03-05T13:29:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TurkandJD](https://avatars.discourse-cdn.com/v4/letter/t/c5a1d2/32.png) [@TurkandJD](https://forum.kirupa.com/u/TurkandJD)\
**Post date:** [March 5, 2010, 1:29pm UTC](https://forum.kirupa.com/t/multiple-hittestobjects-problem/305904/1 "2010-03-05T13:29:10Z")

</div>

Hi can someone help me with some hitTest errors? I’m still learning AS3 and am totally confused with this script:

this.addEventListener(Event.ENTER\_FRAME, rockHit);  
function rockHit(event:Event):void {  
if (SuperCat\_holder.SuperCat\_hitzone.hitTestObject(LRL.LRL\_hitzone)) {  
SuperCat\_holder.gotoAndPlay(2);  
SuperCat\_holder.x -=1;  
}  
else {  
SuperCat\_holder.gotoAndPlay(1);  
}

if (SuperCat\_holder.SuperCat\_hitzone.hitTestObject(MRL.MRL\_hitzone)) {  
SuperCat\_holder.gotoAndPlay(2);  
SuperCat\_holder.x -=1;  
}  
else {  
SuperCat\_holder.gotoAndPlay(1);  
}

```
if (SuperCat_holder.SuperCat_hitzone.hitTestObject(MRH.MRH_hitzone)) {
SuperCat_holder.gotoAndPlay(2);
SuperCat_holder.x -=1;

```

}  
else {  
SuperCat\_holder.gotoAndPlay(1);  
}  
}

Basically, I have three objects that when colliding with SuperCat\_hitzone, should then make SuperCat\_holder change. But the code above seems to ignore every ‘gotoAndPlay’ other than the last one. So it works for MRH\_hitzone but not for the others. If I delete the code for MRH\_hitzone then it works for the code above and so on. Any ideas why it’s doing this?!
