Hi jn19,
There are a few options to do that.
You can look inside your ui file and remove the touch event listener to disable it, and then add it over again to enable it. I’m pretty sure this can by accessed by using
[lua]–to disable
myButton:removeEventListener( “touch”, myButton )
–and to re-enable
myButton.touch = ui.newButtonHandler
myButton:addEventListener( “touch”, myButton )
–but you’ll probably have to globalize the newButtonHandler function in your ui.lua file
– (or coronaui_ui.lua, whatever you are using) by deleting the word “local” that’s in front of it[/lua]
Of course using global variables is a no-no and you are going to have to choose the lesser evil in this case.
Or you could try createing an clear image right on top of your button and adding an touch listener to it that has nothing in the listener function except for “return true”. That would effectively block the touches from going to your button. And you could delete it whenever you want your button working again.
There are probably a dozen different options, but I hope those two provide you with some ideas.
-Matt
W2MD
[import]uid: 10211 topic_id: 12704 reply_id: 46521[/import]