I am trying to use event.target to see which object has been tapped. I have this function that is called by a local event listener:
local param1 = 0
function changeParams(event)
if( event.target == "op1Up" ) then
param1 = param1 + 1
elseif( event.target == "op1Down" ) then
param1 = param1 - 1
end
dispMyParams1.text = ( "Param 1: "..param1 )
end
local op1Up = display.newRect( --[[rect parameters]]-- )
op1Up:addEventListener( "tap", changeParams )
local op1Down = display.newRect( --[[rect parameters]]-- )
op1Down:addEventListener( "tap", changeParams )
event.target return reference to the object, you first need to add a property "name" to all objects then try to identify .name there as I shown in the code.