Tab and Director Conflict

I am new to Corona.
I have possibly made a silly mistake.
I currently have a tab bar with three tabs, which I modified the example one from the samples on the site.

In my first tab, I have a menu.lua, which allows me to go back and forth between a menu and several different pages. Second tab has Screen 2 and Screen 3 for the time being.

Onload I have an intro.lua which skips straight through to the menu page.
Onload everything works fine.

When I go to Screen 2 or Screen 3 and then back to the menu tab, it works, but the actual menu stays on screen obscuring my view.
As I have said, everything works underneath, and the menu itself, functions as well.
Any idea what is causing it to stay onscreen? [import]uid: 155890 topic_id: 29364 reply_id: 329364[/import]

It’s going to be hard to diagnose this without seeing your code. [import]uid: 19626 topic_id: 29364 reply_id: 118008[/import]


– Abstract: Tab Bar sample app

– Version: 1.0

– Sample code is MIT licensed, see http://developer.anscamobile.com/code/license
– Copyright © 2010 ANSCA Inc. All Rights Reserved.

– Demonstrates how to create a tab bar that allows the user to navigate between screens,
– using the View Controller Library, viewController.lua.

–import external classes
local ui = require(“ui”)
local viewController = require(“viewController”)

local mainView, tabView, currentScreen, tabBar

local function loadScreen(newScreen)
if currentScreen then
currentScreen:cleanUp()
end
currentScreen = require(newScreen).new()
tabView:insert(currentScreen)

return true
end

local function showScreen(event)
local t = event.target
local phase = event.phase

if phase == “ended” then
if t.id == 1 then
loadScreen(“menu”)
elseif t.id == 2 then
loadScreen(“screen2”)
elseif t.id == 3 then
loadScreen(“screen3”)
elseif t.id == 4 then
loadScreen(“intro”)
end
tabBar.selected(t)
end

return true
end

local function init()
–Create a group that contains the entire screen and tab bar
mainView = display.newGroup()

–Create a group that contains the screens beneath the tab bar
tabView = display.newGroup()
mainView:insert(tabView)

loadScreen(“intro”)

tabBar = viewController.newTabBar{
background = “tabBar.png”, --tab bar background
tabs = {“Play”, “News”, “About”}, --names to appear under each tab icon
onRelease = showScreen --function to execute when pressed
}
mainView:insert(tabBar)

tabBar.selected()

return true
end

function changeScene (e)
if(e.phase == “ended”) then
director:changeScene(e.target.scene)
end
end

local director = require(“director”);
local mainGroup = display.newGroup();

mainGroup:insert(director.directorView);

–Start the program!
init() [import]uid: 155890 topic_id: 29364 reply_id: 118014[/import]

Couple of observations… You are trying to use director before you require it. You need to move the:

local director = require(“director”)

towards the top of the file.

Then your scene loader isn’t using Director to manage the scenes. You basically have two different methods trying to manage the screens.

[import]uid: 19626 topic_id: 29364 reply_id: 118054[/import]