How to get touch 'began', 'moved' & 'ended' in Corona ?

By | August 21, 2011


For getting touch ‘began’, ‘moved’ & ‘ended’ in Corona, use the following code.

--Your touch event listener
 local function myTouchListener( event )
        if event.phase == "began" then
            print( "Touched!" )
        elseif event.phase == "moved" then
            print( "Touches Moved!" )
        elseif event.phase == "ended" then
            print( "Touches Ended!" )

--Adding an event listener for touch
Runtime:addEventListener( "touch", myTouchListener )


Leave a Reply

Your email address will not be published. Required fields are marked *