disable a button for some time

Is there any way in the corona to make the button stop working for some time interval, and after some time the button becomes active again… [import]uid: 48549 topic_id: 10006 reply_id: 310006[/import]

First use removeEventListener to deactivate the button. Then use performWithDelay to call another function after a wait. In that function use addEventListener to reactivate the button. [import]uid: 12108 topic_id: 10006 reply_id: 36527[/import]

@hamzajavaid_mug
an easier way would be to set a flag, so you can just add

button.isEnabled = false

this by itself will do nothing so handle it in the listener

if “began” == event.phase then
if event.target.isEnabled == false then return end
end

I hope you get the idea.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 10006 reply_id: 36537[/import]

Yes, jayantv’s sugestion is good.

Here is an excerpt from my custom ui.lua which is basically same suggestion

[code]
local function newButtonHandler( self, event )
if self.isEnabled ~= true then return end

end

function newButton( params )

if params.isEnabled ~= nil then
button.isEnabled = params.isEnabled
else
button.isEnabled = true
end
end
[/code] [import]uid: 41267 topic_id: 10006 reply_id: 36676[/import]

thnx guyz for all your help, it i did that using the jayantv trick…and it worked for me…thnx [import]uid: 48549 topic_id: 10006 reply_id: 37181[/import]