Remove all touch events

Hello,

I have a quick question. Do yo you know if it’s possible to remove all touch events on the screen when pressed a button? Without individually removing them? Is their any one code stopping you from touching anything?

Thanks.

  • Michael [import]uid: 23689 topic_id: 21514 reply_id: 321514[/import]

There isn’t a single line of code to remove all touch listeners, you’d manually remove each one using obj:removeEventListener().

That said, why are you removing them? If it is to prevent users clicking them while you have something going on you could use set focus OR you could put a transparent rectangle over your screen that is hitTestable and put a function on it that simply returns true on touch.

Peach :slight_smile: [import]uid: 52491 topic_id: 21514 reply_id: 85130[/import]

Yes that is correct.

Thanks :slight_smile:

So If i return true the touch events will deactivate?

  • Michael [import]uid: 23689 topic_id: 21514 reply_id: 85297[/import]

They wont de-activate. it will just stop touch events leaking to objects below them and also prevents over use of a touch event (without return true, your function could be called x number of times per touch rather than the expected behavior) [import]uid: 84637 topic_id: 21514 reply_id: 85307[/import]

Ok, thanks guys!

That’s exactly what i need to know! :slight_smile:

[import]uid: 23689 topic_id: 21514 reply_id: 85394[/import]