Let’s say
-I have a button that listens to a “tap” event, and directs to a function that does something.
-I put an ImageRact that covers the button. One layer up.
When I click on the cover image just above the area the buttons lies behind , the event function STILL executes.
How do I avoid this?
example:
local function hidebg() display.remove(logo3) logo3=nil end local logo2= display.newImage("logo.png") logo2.x=display.contentCenterX logo2.y=280 logo2.width=200 logo2.height=74 logo2:addEventListener("tap", hidebg) local cover =display.newImageRect("NEW GAME A.png", 480,320) cover.x=display.contentCenterX/2 cover.y=display.contentCenterY/2
The hidebg() function is still executed although the “logo2” is covered by “cover” image.
I know I could make the button isVisible=false and solve the problem, but I have dozens of buttons in different groups in different layers, and I wonder how to do it in a smart way. Maybe somehow disable a whole group? I don’t know.