I’m getting an error when adding an Event Listener. the error occurs on the last line of the following code:
ERROR:
Nov 17 06:27:21.976: Runtime error
addEventListener: listener cannot be nil: nil
[abridged]
– CATEGORY TEXTBOX
txtData_new= native.newTextField( rectData.x,txtLabel_new.y+1,rectData.width,var.fontSizeToUse * textFieldSizeCorrectForApple())
txtData_new.placeholder = “(new Category)”
txtData_new.hasBackground=false
txtData_new.background = {unpack(var.displayObjectSettings.setFillColorBkgData)}
txtData_new.height = var.displayObjectSettings.height
txtData_new:setTextColor (unpack(var.colorBLACK))
txtData_new.font = native.newFont( native.systemFont, var.fontSizeToUse )
txtData_new.strokeWidth = 0
grp:insert(txtData_new)
– listeners
txtData_new:addEventListener( “userInput”, textListener )
The above is generic code that runs exactly as above in three other .lua files, none of which generates this error.
The error occurs in the CS even when I start fresh, ie, it’s virtually the first screen I encounter. i’ve re-pasted the code from the .lua files which work fine - but still the error persists. there does not appear to be an typos.
What can be possible issues that causes textListener to become nil?
thanks very much.
Seth