Hello all,
Can "touch" function work on "line" display object (aka "display.newLine()" )? Please see the stripped down code (for troubleshooting) below. I am not sure if I have missed out anything, but there is no "print" on the Corona Simulator's console, no matter, how much I tried "to touch" on the "line.
-- text display object local text = display.newText( "text", 20, 20 ) -- table touch listener function -- stripped down for troubleshooting local function touch( self, event ) print( event.phase, event.target.id, self.id ) text.text = tostring( event.phase ) .. " | " .. tostring( self.id ) if event.phase == "began" then print( event.phase, event.target.id, self.id ) elseif event.phase == "moved" then print( event.phase, event.target.id, self.id ) elseif event.phase == "ended" then print( event.phase, event.target.id, self.id ) end return true end -- create new line display object and attach listener local line = display.newLine( 50, 50, 300, 300 ) line.strokeWidth = 50 line.touch = touch line.id = "line03" line:addEventListener( "touch" )
Any suggestion or alternative solution? I need the ability to touch the line, in order to show additional information on the line itself.
Please help to advise. Thanks.
Regards, Luan