Touch Problem -- "Ended" not fired when touch moves fast.

My touch listener is giving problems when the user moves the object to fast. The “ended” event is not fire, which is a big problem. 

I stuck some print statements in there so I can monitor when it works good, and when it gives me the bug. When the bug happens the print is “moved”.

Any work around for this problem? I already have the object set focus :

display.getCurrentStage():setFocus( block )

Any help is appreciated.

Hi @cr1x,

Can you please post a little more code showing how you’ve set this all up?

Thanks,

Brent

This happens when the user moves ‘quickly’. If you don’t receive the ‘ended’ event, just put it in yourself. I did it by setting a timer @ ‘began’ and when the timer is up (200 to 1000 ms), it will just register as ‘ended’.

Cr1x, please put your entire “move” code, something else might be failing.

Moving items can result in buggy performances depending on what you are doing in the rest of your code.

I realized the problem was if the user was touching the screen outside of the object and dragged their finger over the object only the “moving” event.phase was called.

“Began” and “Ended” where not called when this happened. So my workaround to fix the problem was easy.

  • I just created a local variable at the top of all the code. Initializing it as false 

  • The touch listener “Moved” event.phase would only fire if the local variable was true. 

  • So during the “Began” phase it would set it to true, and “Ended” phase would set it to false. 

This stopped users from being able to slide there finger from outside of an object to over it which would skip the “Began” and “Ended” phase.

Hi @cr1x,

Can you please post a little more code showing how you’ve set this all up?

Thanks,

Brent

This happens when the user moves ‘quickly’. If you don’t receive the ‘ended’ event, just put it in yourself. I did it by setting a timer @ ‘began’ and when the timer is up (200 to 1000 ms), it will just register as ‘ended’.

Cr1x, please put your entire “move” code, something else might be failing.

Moving items can result in buggy performances depending on what you are doing in the rest of your code.

I realized the problem was if the user was touching the screen outside of the object and dragged their finger over the object only the “moving” event.phase was called.

“Began” and “Ended” where not called when this happened. So my workaround to fix the problem was easy.

  • I just created a local variable at the top of all the code. Initializing it as false 

  • The touch listener “Moved” event.phase would only fire if the local variable was true. 

  • So during the “Began” phase it would set it to true, and “Ended” phase would set it to false. 

This stopped users from being able to slide there finger from outside of an object to over it which would skip the “Began” and “Ended” phase.