I created an app that asks the user for their name but when the app goes to the next scene the text input box remains visible on all other scenes. I’ve tried to add “mainGroup:insert(nameField)” but it does not work (often giving me errors). any suggestions? Thanks in advance.
local myText = display.newText( "Enter your full name", 500, 350, native.systemFont, 38 ) local nameField = native.newTextField( 500, 400, 320, 36 ) nameField.inputType = "name" mainGroup:insert(myText) mainGroup:insert(nameField)
That documentation is about text fields. You need to read the composer.* documenation to understand composer and scene management.
That wasn’t a link to the example code. I’m not going to dig for it, so I’ll assume either you only grabbed a snippet or didn’t get it all. In any case, continue reading for help and advice…
You are not adding your text fields to the scene group. However, it isn’t that simple. Text fields are native objects and need to be hidden or removed as part of the scene transition. This is due to the nature of how the composer.* scene manager actually handles groups.
Here are docs and many examples of using composer.*, including one with text fields (#13)
That documentation is about text fields. You need to read the composer.* documenation to understand composer and scene management.
That wasn’t a link to the example code. I’m not going to dig for it, so I’ll assume either you only grabbed a snippet or didn’t get it all. In any case, continue reading for help and advice…
You are not adding your text fields to the scene group. However, it isn’t that simple. Text fields are native objects and need to be hidden or removed as part of the scene transition. This is due to the nature of how the composer.* scene manager actually handles groups.
Here are docs and many examples of using composer.*, including one with text fields (#13)