I am using the newTextField as the sample from the API documentation states. However, I keep receiving the following warning from the console:
WARNING: The ‘listener’ argument to native.newTextField( left, top, width, height [, listener] ) is deprecated. Call the object method o:addEventListener( ‘userInput’, listener ) instead.
So, I re-wrote my code but I cannot make it work. Can you please help me to understand what I am missing (I know it is something stupid):
[code]
local function fieldHandler_input(getObj)
print(“entered here”)
return function (event)
if (“began” == event.phase) then
elseif (“ended” == event.phase) then
elseif (“submitted” == event.phase) then
local path = system.pathForFile( “alex.txt”, system.DocumentsDirectory )
local file = io.open( path, “w+” )
file:write( toString(getObj().text) )
io.close( file )
native.setKeyboardFocus(nil)
end
end
end
–input = native.newTextField( 723, 6, 271, 37, fieldHandler_input(function() return input end ) )
input = native.newTextField( 723, 6, 271, 37 )
input:addEventListener(input,fieldHandler_input)
input.input = “phone”
[/code] [import]uid: 4883 topic_id: 23765 reply_id: 323765[/import]