Clarification on "isHitTestable" and alpha=0

From the Corona documention, isHitTestable is described as follows:
Allows an object to continue to receive hit events even if it is not visible. If true, objects will receive hit events regardless of visibility; if false, events are only sent to visible objects. Defaults to false.

Just to clarify, a “hit” event is referring to a touch or tap, correct? I want to clarify this isn’t referring to a physics “hit” (in which case I believe “isBodyActive” and similar commands would be applied).

Also, “visibility” can obviously be accomplished through two ways:

"object.alpha = 0"[/code] or [code]"object.isVisible = false".

My testing seems to indicate Corona doesn’t care which method is used in regards to “isHitTestable”. No matter how the object has been made invisible, taps and touches shouldn’t be received on these objects. Has this been proven and tested as true in other people’s experience?

In other words, set its alpha to 0 or set it to “isVisible=false” and (unless “isHitTestable=true”) the object stops receiving hits?

Hopefully somebody can clarify this better.

Brent
[import]uid: 9747 topic_id: 8820 reply_id: 308820[/import]

To answer your first question, yes, a “hit” refers to the object registering touch events.

So if you set isHitTestable to true and you set the isVisible property to false, then it can still be touched–otherwise, by default, if it’s not visible, you can’t touch it.

Also, there is no difference between alpha=0 and isVisible = false … As a rule of thumb, I use alpha if I need to tween the object’s transparency, otherwise, it’s usually easier to just use the isVisible property.

Hope that helps! [import]uid: 52430 topic_id: 8820 reply_id: 32241[/import]

Thanks for the clarification Jon!

However, this API still isn’t working properly for me. I can set “isHitTestable” to false, and I’m still getting touch/tap responses. I thought it was working, but in fact I already had a boolean “flag” in place which determined whether a certain button was active or inactive. This flag was making it seem like “isHitTestable” was functioning, but upon further testing, it was irrelevant.

However , I think this issue has already been fixed! I seem to recall reading about it in one of the Daily Builds reports (as an error noted and already corrected) but now I can’t seem to locate the post about it.

Since I am still using the last “stable” build (2011.268), I’m missing out on alot of the minor improvements. I should probably stop procrastinating and download a more current build, at least for testing purposes until the next official stable release which is presumably coming soon.

Brent
[import]uid: 9747 topic_id: 8820 reply_id: 32385[/import]

Doh! Actually it looks like “2011.484” is the latest release! Downloading now… I guess I was under a rock for the past 2 months (not so far from the truth, I just returned from Australia and the Outback a week ago). That’s my lame excuse and I’m sticking to it. :slight_smile:

[import]uid: 9747 topic_id: 8820 reply_id: 32386[/import]

The name for this property seems slightly confusing to me as there is nothing indicating that it is tied to visibility in the name. Without reading the description, I would have thought it would just enable or disable touch interactions in general. Is there a property that can do this (the same kind of thing as mouseEnabled for acrionscript)? [import]uid: 49649 topic_id: 8820 reply_id: 40301[/import]