Hi,
I have a button that will set a toggle to true when it is touched and toggles to false when the finger is no longer touching it. It works perfectly when my finger is on the image, but when I slide my finger off the image it will not trigger the event.phase == “ended” portion.
Code:
local moveForwardToggle = false local myForwardButton = display.newPolygon (84, 290, {-17, -30, -27, 25, 29, 25, 29, -25}) local function moveForwardListener (event) if (event.phase == "began) then moveForwardToggle = true elseif (event.phase == "ended") then moveForwardToggle = false end return true end myForwardButton:addEventListener ("touch", moveForwardListener)