Is it possible to disable all touch input ( not just multitouch ) ? [import]uid: 5833 topic_id: 25092 reply_id: 325092[/import]
Yes, defacto by not assigning any touch event listeners to your objects. Makes developing a UI a bit tough though. [import]uid: 44647 topic_id: 25092 reply_id: 101931[/import]
Yup that would do it allright, was hoping for something slightly more practical though
[import]uid: 5833 topic_id: 25092 reply_id: 101934[/import]
What I do when I need to temporarily disable touch input is slap an invisible hittestable rectangle on top of everything and give it a listener that does nothing but return true:
[lua]local stopTouchRect = display.newRect(_LEFT,_TOP,_W,_H)
stopTouchRect.isVisible, stopTouchRect.isHitTestable = false,true
stopTouchRect.touch = function(event) return true end
stopTouchRect:addEventListener(“touch”,stopTouchRect)[/lua] [import]uid: 44647 topic_id: 25092 reply_id: 101935[/import]
Whoops, sorry should have been more clear. I’ve done that for object listeners however that doesn’t work for Runtime listeners. [import]uid: 5833 topic_id: 25092 reply_id: 101936[/import]
I may be confused on what you are doing and/or trying to do. However regardless of listener, the simplest way I can think of is to just have a global representing no touching allowed. Check it and if true, ignore and return.
notouch = false
function myRuntime(event)
if notouch == false then
-- do normal stuff
end
return true
end
Runtime:addEventListener("touch", myRuntime)
-- no touch time
notouch = true
-- allow touching again
notouch = false
Again I could be confused and this could be irrelevant. [import]uid: 56820 topic_id: 25092 reply_id: 101955[/import]
No that would work, however I was hoping to be able to do it without having to set a flag etc
Was hoping for system.deactivate( “touch” ) functionality but I guess for now I will have to settle for a flag.
Thanks for the help, really appreciate it! [import]uid: 5833 topic_id: 25092 reply_id: 101956[/import]