# Help! Using a hittest function on several objects

**URL:** <https://forum.kirupa.com/t/help-using-a-hittest-function-on-several-objects/72013>\
**Category:** flash\
**Created:** [December 1, 2004, 2:28pm UTC](https://forum.kirupa.com/t/help-using-a-hittest-function-on-several-objects/72013 "2004-12-01T14:28:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazzie](https://avatars.discourse-cdn.com/v4/letter/m/41988e/32.png) [@mazzie](https://forum.kirupa.com/u/mazzie)\
**Post date:** [December 1, 2004, 2:28pm UTC](https://forum.kirupa.com/t/help-using-a-hittest-function-on-several-objects/72013/1 "2004-12-01T14:28:37Z")

</div>

Hi,

I’m making a jigsaw for an assignment and I have to use functions (as that’s the whole point of the assignment). I can get the code to work easily for one piece, but I’m getting the syntax wrong when I try changing the hitTest objects from “piece01” and “piece01drop” (the invisible “space” where the piece should be placed) to this and this+drop. Obviously I’d want to do it like this as I have 35 pieces (piece02, piece 02drop, piece15, piece15drop and so on). I know how to use the correct syntax with a dropTarget, but the same code isn’t working with hitTest.

This is the (basic) coding I’m using :-

dropTest = function () {  
if (this.hitTest(piece01drop)) {  
this.\_x = piece01drop.\_y;  
this.\_y = piece01drop.\_y;  
}  
};

Where “this” would be the piece (piece01) you move around, and piece01drop is the space where it goes. I just need to know how to do the syntax to make this function work for all the pieces, and not just the first one.

Thank you!
