# hitTest help

**URL:** <https://forum.kirupa.com/t/hittest-help/67535>\
**Category:** flash\
**Created:** [October 17, 2004, 8:51am UTC](https://forum.kirupa.com/t/hittest-help/67535 "2004-10-17T08:51:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sideffect8](https://avatars.discourse-cdn.com/v4/letter/s/dfb087/32.png) [@sideffect8](https://forum.kirupa.com/u/sideffect8)\
**Post date:** [October 17, 2004, 8:51am UTC](https://forum.kirupa.com/t/hittest-help/67535/1 "2004-10-17T08:51:43Z")

</div>

So,  
I’ve been working on a file where two objects collide with each other, but creating two different results.  
ie.[color=darkorange] if (yellow, hitTest(green)){green\_x+=5}[/color], but,  
[color=darkorange]if (green, hitTest(yellow)){yellow\_x-=5}[/color]

This is impossible since [color=darkorange](yellow, hitTest(green)) == (green, hitTest(yellow)).[/color]

So I thought, I’ll have a condition to filter these into two different results, like:  
[color=darkorange]if ((movement=“right”)&&(yellow, hitTest(green))) {green\_x+=5}[/color]  
[color=darkorange]if ((movement=“left”)&&(green, hitTest(yellow))) {yellow\_x+=5}[/color]

----I thought this was pretty clever, and it (kinda) worked, which is the wierd thing. Actionscripts (should) either work or not work, but, one if [color=darkorange]"((move…)"[/color] statement would totally work while the other would work only under random circumstances.

So, the solution was to have each clip create it’s own unique move on the mouse press ( on(press){green.attachMovie…) and have the attached movie do the hitting. This way, the flash player doesn’t confuse the hitting conditions w/ each other by having unique movie clips doing the hitting.

Hope this Helps  
-SLEEP
