Hey,
I have implemented the new widget library into my project and (nearly) everything works just fine. But I can not get the id of widget.newButton anymore.
Here is my code:
local onLevelPickedEvent = function(event) --if event.phase == "release" then print("onLevelPickedEvent") local levelNum = tonumber(event.id) print(levelNum) if (levelNum \<= maxLevel) then print("level "..levelNum.." was selected") storyboard.gotoScene("level"..levelNum, fade) end end --end -- create level buttons via loop for i=1, maxLevel do -- make the button levelPickBtn[i] = widget.newButton { onRelease = onLevelPickedEvent, id = i , label = i, width = 44, height = 39, } print("button") levelPickBtn[i]:setReferencePoint(display.TopLeftReferencePoint) levelPickBtn[i].x = xPos levelPickBtn[i].y = yPos group:insert(levelPickBtn[i]) i = i + 1 if i == 6 or i == 11 or i == 16 then xPos = \_W/5 yPos = yPos + 44 + 16 else xPos = xPos + 44 + 16 end end
Thank you!
Max / CineTek