Hi I found an article that show how to determine in touch phase if touch event is being hold down, but I want to determine if it is being held at the same place, so not being moved but still being hold down. What can I add to this code to see that its not moved and determine the position while its hold down and not moving.
local holding = false
local function enterFrameListener()
if holding then
– 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” then
display.getCurrentStage():setFocus( event.target )
event.target.isFocus = true
Runtime:addEventListener( “enterFrame”, enterFrameListener )
holding = true
elseif event.target.isFocus then
if event.phase == “moved” then
elseif event.phase == “ended” then
holding = false
Runtime:removeEventListener( “enterFrame”, enterFrameListener )
display.getCurrentStage():setFocus( nil )
event.target.isFocus = false
end
end
return true
end