Determine if touch event moved off object, and then cancel event handler?

If I touch an object and then move my finger off of it, I see that the touch event continues.  Specifically, the event remains in the moved phase.

1.) How can my code know if my finger moved off the object?  My finger will still be touching the screen.

2.) How can I cancel my event handler when this happens?

From the Forum to the rescue!

http://forums.coronalabs.com/topic/43532-determining-if-finger-is-within-an-objects-content-bounds/

Thanks.  I thought that might be the solution, but was hoping there was another way.  It could be challenging applying this method to irregularly shaped objects.  The physics engine seems to handle irregularly shaped objects just fine, but it’s not clear how to detect the object’s edge using a touch event.

I guess you could do use masks and some math on complex shape vertices to determined when touch has escaped a certain bounds, but it seems like it would be more trouble than it’s worth.

Maybe you could also make your irregularly shaped button a static physics object, and make a user’s touch spawn another dynamic physics object, and have some logic that would identify when the dynamic touch object interacted with the static button object? Just spitballing here.

From the Forum to the rescue!

http://forums.coronalabs.com/topic/43532-determining-if-finger-is-within-an-objects-content-bounds/

Thanks.  I thought that might be the solution, but was hoping there was another way.  It could be challenging applying this method to irregularly shaped objects.  The physics engine seems to handle irregularly shaped objects just fine, but it’s not clear how to detect the object’s edge using a touch event.

I guess you could do use masks and some math on complex shape vertices to determined when touch has escaped a certain bounds, but it seems like it would be more trouble than it’s worth.

Maybe you could also make your irregularly shaped button a static physics object, and make a user’s touch spawn another dynamic physics object, and have some logic that would identify when the dynamic touch object interacted with the static button object? Just spitballing here.