–[[
Is there a way to understand how many display objects have been hit before,
i.e understand the event’s propagation deepth ?
-
i don’t want to use a global counter
-
unfortunately, event seems to be passed by value, and therefore my modifications to the event don’t stick
Click on the rectangle to run it
]]–
local r2 = display.newRect( 10,10,50,50)
local r1 = display.newRect( 10,10,50,50)
r1:addEventListener(“tap”, function(e) e.depth= ( e.depth and e.depth +1 ) or 1 print(e.depth) return false end)
r2:addEventListener(“tap”, function(e) e.depth= ( e.depth and e.depth +1 ) or 1 print(e.depth) return false end)
– getting
1
1
- want
1
2
any ideas