Stopping Touch Propogation...been trying for hours now. Solved while asking. :P

***Fixed***
***Thanks**
***Posting anyway in case it helps anyone :slight_smile:
:slight_smile: Yes I’m a noob, and yes the answer will be simple.

I have a board game which has a human and cpu player that take turns.
When the CPU player is taking its turn, I want to disable all touch events except the main menu button.

I have created a screen sized imageRect, added it to the localGroup right at the end so its supposedly on top, set its alpha to .5 so I know if its there or not :wink: and have a couple of functions that run at the end of each turn to add and remove event listeners as follows…

[lua]function blockTouch()
battle.overlay:addEventListener( “touch”, battle.overlay )
battle.overlay.alpha = (.8)
td(100,function() lg:insert(battle.overlay) end)
end
function unBlockTouch()
battle.overlay:removeEventListener( “touch”, battle.overlay )
battle.overlay.alpha = (0)
end

and

overlay = display.newRect(0,0,display.contentWidth,display.contentHeight)
overlay:setFillColor(0,0,0,100)
function overlay:touch(event)
–print(“Touched Overlay”)
return true
end[/lua]

This works for one of the buttons on the screen, but all the others still register touch events…

******************************************************************
OK, I just figured it out while typing this. Strange how writing things down make them easier to process :slight_smile:

I was using two different listeners for different parts of my code.
[lua]touch[/lua] and [lua]tap[/lua]
The buttons that were still working were listening for taps.
Sigh. [import]uid: 34945 topic_id: 9005 reply_id: 309005[/import]