events not picked up in areas where alpha=0? (trying to make a IOS 7 button)

Is it a bug that events are NOT getting triggered for my “circle” object when I turn the alpha down to zero(0) for it’s fill?  

I’m making an IOS7 like button and using a circle however it won’t pickup the event.  Seems like I’ll need to set the alpha to 0.01 or something like that.

-- CIRCLE BORDER local myCircle = display.newCircle( 100,100, 100 ) -- myCircle:setFillColor(128,128,128,  0.01)        -- WORKS myCircle:setFillColor(128,128,128,  0)                -- DOES NOT WORK myCircle.strokeWidth = 5 myCircle:setStrokeColor(0,0,0)   -- LISTENER SETUP local function localHandler(event)     print(event.phase) end myCircle:addEventListener("touch", localHandler)  

You can use isHitTestable http://docs.coronalabs.com/daily/api/type/DisplayObject/isHitTestable.html

I’m not 100% sure if it works in your case since you are not using isVisible but rather a 0 fill. Give it a go.

thanks Jon - I think I’ve heard of that one now you mention it but have never used it before - I’ll try/use this…

yep - worked fine - thanks :slight_smile:

Jon is right on.  Both .isVisible = false or .alpha = 0 are used to by default disable touch events.  You have to set the .isHitTestable flag to true to have it work on invisible objects.

Rob

You can use isHitTestable http://docs.coronalabs.com/daily/api/type/DisplayObject/isHitTestable.html

I’m not 100% sure if it works in your case since you are not using isVisible but rather a 0 fill. Give it a go.

thanks Jon - I think I’ve heard of that one now you mention it but have never used it before - I’ll try/use this…

yep - worked fine - thanks :slight_smile:

Jon is right on.  Both .isVisible = false or .alpha = 0 are used to by default disable touch events.  You have to set the .isHitTestable flag to true to have it work on invisible objects.

Rob