If you have two display objects overlapping with a touch event on both of them and then click on the over lapping area you will fire both of the functions. How could I prevent it so only the one thats on the top most layer gets fired while the one under it gets ignored?
example on what I mean
red = display.newRect(25,25,50,50) red:setFillColor(1,0,0) red.alpha = .5 green = display.newRect(50,50,50,50) green:setFillColor(0,1,0) green.alpha = .5 function touchRed(event) if event.phase == "began" then print("Red") end end function touchGreen(event) if event.phase == "began" then print("Green") end end red:addEventListener("touch",touchRed) green:addEventListener("touch",touchGreen)
as you see it will print red and green but as green is on top it should only print green
