Losing touch events in on-screen controls

Hello all,

I’m developing a game that uses up/left/right buttons on screen. I have an event listener on each and for the most part, it works perfectly. Also, I do meed multitouch as you are controlling a car so up and left/right can be pressed at the same time (for accelleration and steering).

However, sometimes you may accidentally slide you findertip off a button and therefore I’m losing the “ended” event so sometimes the car will go into a spin, or permanently accelerate until they tap the offending button again the send an “ended” event.

Does anyone have any idea of the best way to resolved this? [import]uid: 87794 topic_id: 29775 reply_id: 329775[/import]

Add this in the “began”

display.getCurrentStage():setFocus(event.target)

and this in the “ended”

display.getCurrentStage():setFocus(nil)
[import]uid: 160496 topic_id: 29775 reply_id: 119490[/import]

Thanks, I’ve tried that and as I suspected, I’m losing multi-touch i.e. I can’t accelerate and turn at the same time. I’ll do some more digging but I think I may have to approach it another way. [import]uid: 87794 topic_id: 29775 reply_id: 119498[/import]

With multi-touch, what I would do is treat the whole screen as a “touch area” (with the focus, so that “ended” would be received) and use event.x and event.y to identify what was touched…

[import]uid: 160496 topic_id: 29775 reply_id: 119528[/import]

Thanks, I’ve tried that and as I suspected, I’m losing multi-touch i.e. I can’t accelerate and turn at the same time. I’ll do some more digging but I think I may have to approach it another way. [import]uid: 87794 topic_id: 29775 reply_id: 119498[/import]

With multi-touch, what I would do is treat the whole screen as a “touch area” (with the focus, so that “ended” would be received) and use event.x and event.y to identify what was touched…

[import]uid: 160496 topic_id: 29775 reply_id: 119528[/import]