I’m having a similar problem with another button / handler.
I have two buttons associated to the handler.
to avoid the double touch i changed onEvent by onRelease but it launches me an error. It seems is because I use the event id to discriminate between buttons. So i added the if event.phase statement but now the instruction are not executed. I checked that the button is touched but none of the if (began, ended or cancelled) is executed.
button
[lua] backBtn = ui.newButton{
default = “backButton.png”,
over = “backButton_over.png”,
onEvent = backBtnHandler,
id = “back1”,
–text = “B1”
}[/lua]
Function
[lua]function backBtnHandler( event )
selfb = event
local backid = selfb.id
print(backid … " pressed ")
if event.phase == “began” then
print (“began”)
elseif event.phase == “moved” then
print (“moved”)
elseif event.phase == “ended” or event.phase == “cancelled” then
–if event.phase == “began” then
print (“ended”)
end
return true
end[/lua]
In this example I just got :
back1 pressed
back1 pressed
[import]uid: 60723 topic_id: 24608 reply_id: 100477[/import]