Problem with touch event when moving finger out of screen

I did an actor with the size of the screen and a touch listener.

When the actor is touch the listener changes variable main_char.standBy to true and when its ended it changes it to false.

The problem i have is when someone is touching the screen and moves the finger very fast out of the screen. In this case the variable main_char.standBy wont change to false…

here is my code…

main_char.standBy = false

function main_pad:touch( event )

    if event.phase == “ended” then
        main_char.standBy = false
    else
        main_char.standBy = true
    end

    return true

end

main_pad:addEventListener( “touch”, main_pad )

does anyone know what i can do to fix it?
 

You can fix this by checking the moved phase the same way you check the ended phase with some extra conditional logic.

if ( event.phase == "ended" or event.phase == "moved" ) then --Do something

More about the phases for events http://docs.coronalabs.com/api/event/touch/phase.html

You can fix this by checking the moved phase the same way you check the ended phase with some extra conditional logic.

if ( event.phase == "ended" or event.phase == "moved" ) then --Do something

More about the phases for events http://docs.coronalabs.com/api/event/touch/phase.html