help on how to specify a text for a command

my code

how would i make it so say if i type hello in the text it causes a transition

local  defaultField

local function  textListener( event )

if (event == “began”) then

print (event.text)

elseif ( event.phase == “ended” or event.phase == “submitted”) then

print(event.target.text)

elseif ( event.phase == “ended”) then

print( event.newCharacters)

print( event.oldText)

print( event.startPosition)

print( event.text )

end

end

field = native.newTextField(150, 150, 180, 30)

field:addEventListener(“userInput”, textListener)

field.autocorrectionType = “UITextAutocorrectionTypeNo”

Please use code tags but here is some modifications that might get you started:

local text\_field local function textListener( event ) local txt = event.target.text if ( event.phase == "ended" or event.phase == "submitted") then -- HERE THE USER HAVE STOPPED WRITING i.e. HE PUSHED "Return" ON HIS KEYBOARD if txt == "hello" then composer.gotoScene( "myScene" ) end end end text\_field = native.newTextField(150, 150, 180, 30) text\_field:addEventListener("userInput", textListener) text\_field.autocorrectionType = "UITextAutocorrectionTypeNo"

Best regards,

Tomas

About Composter: https://docs.coronalabs.com/daily/api/library/composer/index.html

You might want to use event.phase == “editing”: https://docs.coronalabs.com/api/library/native/newTextField.html

Best regards,

Tomas

Please use code tags but here is some modifications that might get you started:

local text\_field local function textListener( event ) local txt = event.target.text if ( event.phase == "ended" or event.phase == "submitted") then -- HERE THE USER HAVE STOPPED WRITING i.e. HE PUSHED "Return" ON HIS KEYBOARD if txt == "hello" then composer.gotoScene( "myScene" ) end end end text\_field = native.newTextField(150, 150, 180, 30) text\_field:addEventListener("userInput", textListener) text\_field.autocorrectionType = "UITextAutocorrectionTypeNo"

Best regards,

Tomas

About Composter: https://docs.coronalabs.com/daily/api/library/composer/index.html

You might want to use event.phase == “editing”: https://docs.coronalabs.com/api/library/native/newTextField.html

Best regards,

Tomas