I’m trying to get user input in an OS X app and was just going to use the example code from the Docs. However whenever I compile the app it just creates a black screen. There seems to be a textfield in the middle, but it does not seem to respond. Anyone else having this issue?
[lua]
display.newRect(display.contentCenterX,display.contentCenterY,display.contentWidth,display.contentHeight)
local defaultField
local function textListener( event )
if ( event.phase == “began” ) then
– user begins editing defaultField
print( event.text )
elseif ( event.phase == “ended” or event.phase == “submitted” ) then
– do something with defaultField text
print( event.target.text )
elseif ( event.phase == “editing” ) then
print( event.newCharacters )
print( event.oldText )
print( event.startPosition )
print( event.text )
end
end
– Create text field
defaultField = native.newTextField( display.contentCenterX, display.contentCenterY, 180, 30 )
defaultField:addEventListener( “userInput”, textListener )
[/lua]