lua - Touch Hold Event In corona SDK -
i wondering how check if user has touched screen, holding touch down , not moving. please if have can go from. ive been looking around , have yet find handle this.
you can use/modify this: (it's rob miracle says)
local holding = false local function enterframelistener() if holding -- holding button -- code here -- code here -- code here else -- not holding -- code here -- code here -- code here end end local function touchhandler( event ) if event.phase == "began" display.getcurrentstage():setfocus( event.target ) event.target.isfocus = true runtime:addeventlistener( "enterframe", enterframelistener ) holding = true elseif event.target.isfocus if event.phase == "moved" elseif event.phase == "ended" holding = false runtime:removeeventlistener( "enterframe", enterframelistener ) display.getcurrentstage():setfocus( nil ) event.target.isfocus = false end end return true end
i believe obvious touchhandler function ^^
Comments
Post a Comment