Type Event Dispatch chain ▸ Display Object ▸ Runtime Revision 2017.3060 Keywords tap See also Tap/Touch/Multitouch (guide) system.setTapDelay()
Generates a hit event when the user touches the screen. The event is dispatched to display objects in the display hierarchy. This is similar to the touch event except a hit count (number of taps) is available in the event callback.
local object = display.newImage( "ball.png" ) object.name = "ball object" local function onObjectTap( event ) print( "Tap event on: " .. event.target.name ) return true end object:addEventListener( "tap", onObjectTap )
local object = display.newImage( "ball.png" ) object.name = "ball object" local function onObjectTap( self, event ) print( "Tap event on: " .. self.name ) return true end object.tap = onObjectTap object:addEventListener( "tap", object )
local object = display.newImage( "ball.png" ) object.name = "ball object" function object:tap( event ) print( "Tap event on: " .. self.name ) return true end object:addEventListener( "tap", object )