# Hittest doesn't work always

**URL:** https://forum.kirupa.com/t/hittest-doesnt-work-always/549732
**Category:** flash
**Created:** [February 22, 2015, 12:35pm UTC](https://forum.kirupa.com/t/hittest-doesnt-work-always/549732 "2015-02-22T12:35:19Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![panoss](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@panoss](https://forum.kirupa.com/u/panoss)
#### Post date: [February 22, 2015, 12:35pm UTC](https://forum.kirupa.com/t/hittest-doesnt-work-always/549732/1 "2015-02-22T12:35:21Z")

</div>

I 'm trying to check collision of two objects in a fash cs3 project.  
It’s a Sprite called Pin (uses pin.png) and a Sprite called Balloon (uses balloon1.png).  
With **balloon1.png it works ok (it works always)**, but when I replace balloon1.png with another png (balloon2.png) it **sometimes doesn’t work.**  
Both ballons have transparency, I don’t know if this has some impact on hittest.  
I tried and with png and jpg without transparency, but the same thing happened: **sometimes hittest didn’t work.**  
What should I check to make it always work correctly?  
(the code is: if (bubble.hitTestObject(\_pin))

---

<div class="post-metadata">

### Author: ![tbo](https://avatars.discourse-cdn.com/v4/letter/t/7feea3/32.png) [@tbo](https://forum.kirupa.com/u/tbo)
#### Post date: [February 22, 2015, 1:18pm UTC](https://forum.kirupa.com/t/hittest-doesnt-work-always/549732/2 "2015-02-22T13:18:41Z")

</div>

you would have to post more code but two guesses would be they are in different coordinate spaces, or you are not calling the hittest at the right time, or only calling it once

---

<div class="post-metadata">

### Author: ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)
#### Post date: [February 22, 2015, 2:34pm UTC](https://forum.kirupa.com/t/hittest-doesnt-work-always/549732/3 "2015-02-22T14:34:36Z")

</div>

How about you post balloon1.png and balloon2.png?

---

<div class="post-metadata">

### Author: ![panoss](https://avatars.discourse-cdn.com/v4/letter/p/db5fbb/32.png) [@panoss](https://forum.kirupa.com/u/panoss)
#### Post date: [February 22, 2015, 3:39pm UTC](https://forum.kirupa.com/t/hittest-doesnt-work-always/549732/4 "2015-02-22T15:39:42Z")

</div>

The one that works well (BubbleBitmap) is embedded in this fla:[http://www.freeactionscript.com/download/as3/realistic-floating-soap-bubbles.zip](http://www.freeactionscript.com/download/as3/realistic-floating-soap-bubbles.zip)

The one that doesn’t work always is: ![](http://forum.kirupa.com/uploads/kirupa/7183/01a4768dfb258c61.png)
