Hi Team,
I am having a image button and once after click it i need to make it disable ( Events should not trigger even if the Events not removed). Can you tell me how can i use it... I referred this below code but it didnt work for me. Please give me specific code.
wpPiece3.enabled = true -- to make it click
-- OR --
wpPiece3.enabled = false -- to make it not click
Thanks
DoradoLab
Comments
-Make a state variable for your button called enabled, in your button class. If you are not using a class for button maybe just a global variable do the trick.
Let's name it;
enabled=true
-By default it will be enabled then when pressed one time on event of onpress just make an if clause like,
if enabled then
--write your code here
enabled=false
end
-Whenever you want to activate it just change the enabled variable to enabled=true and your events will work again.
But if you are asking my opinion removing the listener will be much more easy:D
https://github.com/gideros/Button/blob/master/button.lua
you can modify it by adding two methods: