# Read hittest from distance

**URL:** <https://forum.kirupa.com/t/read-hittest-from-distance/310220>\
**Category:** flash\
**Created:** [June 4, 2010, 4:57pm UTC](https://forum.kirupa.com/t/read-hittest-from-distance/310220 "2010-06-04T16:57:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pedang](https://avatars.discourse-cdn.com/v4/letter/p/a3d4f5/32.png) [@Pedang](https://forum.kirupa.com/u/Pedang)\
**Post date:** [June 4, 2010, 4:57pm UTC](https://forum.kirupa.com/t/read-hittest-from-distance/310220/1 "2010-06-04T16:57:58Z")

</div>

Hi, is there a way to detect a hittest with two objects colliding from a distance? For example if I move an object like 5 pixels to the right, then it will touch the other object; is there a way to see this?

I used my imagination to create the following code ofr this:

```auto
 if(block1.x + 2 == block1.hitTestObject(block2)) { //this is when he's 2 pixels away from Block2 } else {
 
 //Or else?
 
 }

```

As you can see I want Flash to do something when he’s 2 pixels away from block 2.

Unfortunately this code didn’t work. But I hope you understand what I try to do.

I hope anyone can help me,  
Thanks;)
