I’ve found that if your finger (or mouse) is moving quickly across the screen (fast swipe) when you lift it, the “ended” event.phase is sometimes missed.
Steps to reproduce:
- touch and hold your finger/mouse to the screen
- quickly swipe your finger/mouse across the screen
- lift your finger/mouse while still swiping
- notice that “ended” does not always print to the terminal (when using the following example code).
Here’s a simple example to test with:
local function touchMyRectangle(event)
local phase = event.phase
if phase == "began" then
print("began")
end
if phase == "ended" or phase == "cancelled" then
print("ended")
end
end
local myRectangle = display.newRect(0, 0, 480, 320)
myRectangle:setFillColor(255, 255, 255, 100)
myRectangle:addEventListener( "touch", touchMyRectangle )
[import]uid: 48658 topic_id: 10521 reply_id: 310521[/import]