Hi
I have a question about objects of widget. I’m working with storyboard scenes and in one scene called “menu” I have create a button “play” with the following code:
local StartButton = widget.newButton{
id = “btn001”,
style = “blue2Large”,
fontSize = 18,
left = 500,
top = 380,
label = “Play”,
width = 150, height = 46,
cornerRadius = 8,
onEvent = StartButtonEvent
}
This is working fine, and when I touch the button the defined onEvent (StartButtonEvent) will execute. Inside the local function StartButtonEvent, I remove the button with the following lines
display.remove(StartButton)
StartButton = nil
After this I switch to another screen. Problem is, in the new scene the button is not visible (thats ok) but the onEvent is still active, this means if I tape in the region where the StartButton was placed the StartButtonEvent will execute again.
Questions:
If I remote the widget object, then only the object and not the event listener to this object will remove ? Is this a buck or is this normally ?
Who can I remove the event listener of my widget object, or how can I get the name and the necessary parameter of this event listener to use the removeEventlistener function?
Thanks for help
Greetings
Michael [import]uid: 96270 topic_id: 25764 reply_id: 325764[/import]