So I took the app template and changed view two to be this:
[blockcode]
–
– view2.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
– BEGINNING OF YOUR IMPLEMENTATION
– NOTE: Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
– create a white background to fill screen
local bg = display.newRect( 0, 0, display.contentWidth, display.contentHeight )
bg:setFillColor( 255 ) – white
local textField = native.newTextField( 50, 50, 220, 25, handlerFunction )
textField:setReferencePoint( display.CenterReferencePoint )
textField.inputType = “text”
– all objects must be added to group (e.g. self.view)
group:insert( bg )
group:insert( textField )
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– do nothing
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
end
– If scene’s view is removed, scene:destroyScene() will be called just prior to:
function scene:destroyScene( event )
local group = self.view
end
– END OF YOUR IMPLEMENTATION
– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )
– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )
– “exitScene” event is dispatched whenever before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )
– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )
return scene
[/blockcode]
Scene one looks as it should, and scene two looks as it should when I switch to it, but when I go back to scene one the text field appears there as well. I tried [lua] textField = nil [/lua] but that didn’t work. Do I have to destroy it somehow?
Thanks. [import]uid: 180657 topic_id: 31288 reply_id: 331288[/import]