Hello
I got a serious problem and I really need some help. Because it’s make me crazy
My application use the tabbar widget and storyboard to change scenes. This works good.
[code]-- require controller module
local storyboard = require “storyboard”
local widget = require “widget”
– load first screen
storyboard.gotoScene( “scene1” )
local function onOnePress( event )
storyboard.gotoScene( “scene1”, “fade”, 0 )
return true
end
local function onTwoPress( event )
storyboard.gotoScene( “scene2”, “fade”, 0 )
return true
end
local tabButtons = {
{
label=“Scene1”,
up=“icon1.png”,
down=“icon1-down.png”,
width=32, height=32,
onPress=onOnePress,
selected=true
},
{
label=“Scene2”,
up=“icon2.png”,
down=“icon2-down.png”,
width=32, height=32,
onPress=onTwoPress
},
}
– create the actual tabBar widget
local tabBar = widget.newTabBar{
top = display.contentHeight - 50,
buttons = tabButtons
}[/code]
The code works fine, but the problem is that in scene 2 there are nativeTextFields.
Problem:
1, Start app, scene 1 is load and scene 1 is on the screen.
2, User touched the scene 2 tabbar icon. --> Scene 2 is on the screen.
3, User touched back to scene 1 on the scene 1 tabbar icon. --> Scene 1 is on the screen.
4. Scene 1 is on the screen + nativeTextFields from scene 2 is on the screen!
The nativeTextFields must not be visible on scene 1… but how do I fix this? The must be removed/hide…
I build a test function in scene 2. And this function works! When the user touched the test image the nativeTextFields are not showed on the screen of scene 1:)
But how can I add this or a better function to the main.lua file in the tabbar?
function zero()
textfield.alpha = 0
end
image = display.newImage( "bg.jpg" )
screenGroup:insert( image )
image.touch = onSceneTouch
[code]
local function onSceneTouch( self, event )
if event.phase == “began” then
zero()
storyboard.gotoScene( “scene1”, “fade”, 0 )
return true
end
end[/code]
I think I’m on the right way, but need some help to make this work better
Thanks. [import]uid: 150924 topic_id: 29368 reply_id: 329368[/import]