Hi,
I have the following code (thanks @nich sherman) after 3 clicks i need to stop the addEventListener… how and where?
Best regards
Juan
- local buttonText = {1,2,3,4,5}
- local touchButton = function (event)
- local obj = event.target
- local bid = obj.id
- if event.phase == “ended” then
- print (“Button “…bid…” was pressed”)
- end
- end
- for a = 1, #buttonText, 1 do
- local g = display.newGroup()
- local i = display.newRect(g, 0,0,100, 40)
- local t = display.newText(g, buttonText[a],0, 0, native.systemFont, 10)
- g.x = 160
- g.y = a * 48
- g:addEventListener(“touch”,touchButton)
- g.id = a
- end