Tap on display objects overlap

I’m trying to print taps from 3 different display objects but more than the one tapped are printed in the Terminal. They need their own specific function but that’s not possible as of now. What should I do? I am new to Corona and LUA.

-- BOBLER DISPLAY OBJEKTER local sport1 = display.newImage("images/sport1.png") sport1.id = "mySport1" sport1.x = 120 sport1.y = 90 sport1:scale(1,1) local gossip1 = display.newImage("images/gossip1.png") gossip1.id = "myGossip1" gossip1.x = 400 gossip1.y = 120 gossip1:scale(1,1) local kultur1 = display.newImage("images/kultur1.png") kultur1.id = "myKultur1" kultur1.x = 250 kultur1.y = 200 kultur1:scale(1,1) local function onSport1Tap( self, event ) print(self.id .. " was tapped." ) end local function onGossip1Tap( self, event ) print(self.id .. " was tapped." ) end local function onKultur1Tap( self, event ) print(self.id .. " was tapped." ) end -- TAP addEVENTLISTENER sport1.tap = onSport1Tap sport1:addEventListener( "tap", sport1 ) gossip1.tap = onGossip1Tap gossip1:addEventListener( "tap", gossip1 ) kultur1.tap = onKultur1Tap kultur1:addEventListener( "tap", kultur1 )

Hi @jacobseirup,

For this, you need to “return true” in the event listener. This stops the event from “propagating” to underlying objects.

This is detailed in the following guide:

http://docs.coronalabs.com/guide/events/detectEvents/index.html

Best regards,

Brent Sorrentino

Hi @jacobseirup,

For this, you need to “return true” in the event listener. This stops the event from “propagating” to underlying objects.

This is detailed in the following guide:

http://docs.coronalabs.com/guide/events/detectEvents/index.html

Best regards,

Brent Sorrentino