Removing native.textField

Hello,

I am a total beginner with corona so bear with me…

I am writing an app that has an admin section, to access the admin section, from main.lua I first call the home scene, in this scene there is a little icon that the users click. Upon clicking this action the user lands on password.lua, which is an intermediary scene where I ask the user to enter a password to access the admin area. If the password is correct then they are sent to admin.lua.

In the exitScene event of the password scene I am removing the native text field by using:

txtPasscode:removeSelf()
txtPasscode = nil

as explained in the documentation. So far so good, the problem is that if I then return home and press the admin button again, I am again taken to the password scene but this time there is no text field, it vanishes.

If I comment out the code to remove the txtPasscode field then it remains visible in subsequent screens.

I’ve been struggling with this for days and would appreciate any help.
thanks in advance. [import]uid: 170811 topic_id: 32778 reply_id: 332778[/import]

If you’re using storyboard, you probably should create the text filed in the enterScene() phase. createScene() only gets called if the scene is purged or removed, which it does not do by default.

I tend to believe if its something you need to remove in exitScene() it needs to be created in enterScene. If its something you create in createScene() that’s not auto cleaned up, then those things need to go away in destroyScene() [import]uid: 19626 topic_id: 32778 reply_id: 130337[/import]

If you’re using storyboard, you probably should create the text filed in the enterScene() phase. createScene() only gets called if the scene is purged or removed, which it does not do by default.

I tend to believe if its something you need to remove in exitScene() it needs to be created in enterScene. If its something you create in createScene() that’s not auto cleaned up, then those things need to go away in destroyScene() [import]uid: 19626 topic_id: 32778 reply_id: 130337[/import]

Thanks Rob, that worked a treat. [import]uid: 170811 topic_id: 32778 reply_id: 130442[/import]

Thanks Rob, that worked a treat. [import]uid: 170811 topic_id: 32778 reply_id: 130442[/import]