Touch events and alpha values

I found a strange thing with graphics and alpha. I have a background image that rotates. On top of that I have some “stubs” that the user can drag to rotate the background image. (It’s a gear and the stubs are placed on top of the gear teeth)

Anyway, I’ve used a generic place holder for the stubs so far. The stubs shouldn’t really be visible to the user though, they’re just there to record the touch event and allow the user to rotate the gear. So I figure I just set the alpha of the stub to zero. 

Well, that doesn’t work at all. In the simulator once I click on the stub to rotate nothing happened. Hmm, so I decide to turn the alpha to .5 and that works. I can still see the stubs though. So then through trial and error it appears that I can turn the alpha of the stub down to .004 before the touch events are no longer registering. 

It’s not much of a problem considering that at alpha .004 the user can’t see the stubs anyway but I thought it was interesting that the level of alpha affected the touch functionality. 

Maybe this is a well known issue and I just haven’t used enough search kung fu. If so, I apologize in advance.

@WideAwakeGames

This property might do the trick:

http://docs.coronalabs.com/api/type/DisplayObject/isHitTestable.html

Interesting, the example explicitly sets the object as not visible before making it hittable. I suppose that at some point the alpha going low enough would be equivalent to notvisible. I’ll test out the ishittestable property later today.

Edit: I used the isvisible = false and ishittestable = true that works like a charm.

@WideAwakeGames

This property might do the trick:

http://docs.coronalabs.com/api/type/DisplayObject/isHitTestable.html

Interesting, the example explicitly sets the object as not visible before making it hittable. I suppose that at some point the alpha going low enough would be equivalent to notvisible. I’ll test out the ishittestable property later today.

Edit: I used the isvisible = false and ishittestable = true that works like a charm.