Hi guys, I have a “touch” event that calls a “changeSpeed” function. I need to speed up when the touch “began” and then speed down when the touch “ended”. The event is added in a image and everything works fine except when the user moves the finger outside the image while still touching the screen and then removes it from the screen. Doing this the “ended” phase is never called and I don’t know how to speed down.
This is my code:
local changeSpeed = function ( event ) if event.phase == "began" then speed = 20 elseif event.phase == "ended" then speed = 10 end return true end local playerCar = display.newImageRect("images/playerCar.png", carWidth, carHeight) playerCar:addEventListener ("touch", changeSpeed )
How can I call the code inside the “ended” phase when the user moves the finger away from the car image???
Thanks a lot!!