Ah I will use this method instead thank you.
Any ideas why this isn’t working…
[lua]
local function textListener( event )
local target = event.target
local maxLen = target.maxLen
local text = event.text
if ( event.phase == “began” ) then
print( text )
else
if( text and string.len( text ) > maxLen ) then – aborts early if text is nil
target.text = string.sub( text, 61, maxLen )
end
end
end
[/lua]
[lua]
–textBoxBuilding
local textBoxBuilding = native.newTextField( 160, 146, 300, 40 )
textBoxBuilding.size = 20
textBoxBuilding:addEventListener( “userInput”, textListener )
sceneGroup:insert( textBoxBuilding )
[/lua]
I keep getting this runtime error
29: attempt to compare nil with number
Thanks again,
Matt.