Scene navigation issue, white screen?

Hi guys,

In my main.lua I have a tab bar which allows my app to navigate between three scenes “Home, Forms, and Settings” the issue i’m having is once the button is clicked on, the scene then plays the scene transition animation and changes scene, no issues. Now when I attempt to change the scene after clicking a tab button and during the scene transition animation, rather than changing to the scene I clicked on the second time I just get a white screen. Any Ideas?

Issue Example:

On Home: Tab button Form is clicked.

On Home: Transition animation begins 

On Home/Form: During transition button Settings is clicked

On Form/Settings: Transition animation begins from Form to White Screen.

On Settings: White screen

My code looks like this…

[lua]

display.setDefault( “background”, 1, 1, 1 )

local widget = require( “widget” )

local composer = require “composer”

local results = composer.gotoScene( “home” )

local myImage = display.newImage( “TabBarBackground.png” )

myImage:translate( 160, 500 )

local function onFirstView( event )

    composer.gotoScene( “home”, { effect=“slideRight”, time=800} )

end

local function onSecondView( event )

    composer.gotoScene( “forms”, { effect=“slideRight”, time=800} )

end

local function onThirdView( event )

    composer.gotoScene( “settings”, { effect=“slideRight”, time=800} )

end

local options = {

    width = 105,

    height = 50,

    numFrames = 3,

    sheetContentWidth = 315,

    sheetContentHeight = 50

}

local radioButtonSheet = graphics.newImageSheet( “radioButtonSheet.png”, options )

local radioGroup = display.newGroup()

local radioButton1 = widget.newSwitch

{

    left = 1,

    top = 475,

    style = “radio”,

    id = “RadioButton1”,

    width = 105,

    height = 50,

    initialSwitchState = true,

    onPress = onFirstView,

    sheet = radioButtonSheet,

    frameOff = 1,

    frameOn = 2

}

radioGroup:insert( radioButton1 )

local radioButton2 = widget.newSwitch

{

    left = 106,

    top = 475,

    style = “radio”,

    id = “RadioButton2”,

    width = 106,

    height = 50,

    onPress = onSecondView,

    sheet = radioButtonSheet,

    frameOff = 1,

    frameOn = 2

}

radioGroup:insert( radioButton2 )

local radioButton3 = widget.newSwitch

{

    left = 212,

    top = 475,

    style = “radio”,

    id = “RadioButton3”,

    width = 108,

    height = 50,

    onPress = onThirdView,

    sheet = radioButtonSheet,

    frameOff = 1,

    frameOn = 2

}

radioGroup:insert( radioButton3 )

[/lua]

Thanks again,

Matt.

Are you getting any errors in your console log?

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

Hi Rob,

The only error I seem to be getting is

Warning: could not load font HelveticaNeue-Light. Using default font.

Which I didn’t think would be the issue so I haven’t taken much notice of this. 

Do you think this could be the issue?

Thanks,

Matt.

Your code is not a composer scene.  In line 4 you try to jump to a composer scene.  The rest of the code won’t run.   The main.lua should not be a scene, but a place where you setup your code and then jump to a composer scene.

Rob

Hi Rob,

I tried removing line 4 [lua] local results = composer.gotoScene( “home” ) [/lua]

and I was still presented with the same issue, how do you suggest I go about fixing this issue?

Thanks again,

Matt.

Are you sure there are no other messages in your console log about missing images?

Also it looks like you’re trying to build a tab bar.  Is there a reason you’re doing it with newSwitch instead of newTabBar()?

Rob

Are you getting any errors in your console log?

http://docs.coronalabs.com/guide/basics/debugging/index.html

Rob

Hi Rob,

The only error I seem to be getting is

Warning: could not load font HelveticaNeue-Light. Using default font.

Which I didn’t think would be the issue so I haven’t taken much notice of this. 

Do you think this could be the issue?

Thanks,

Matt.

Your code is not a composer scene.  In line 4 you try to jump to a composer scene.  The rest of the code won’t run.   The main.lua should not be a scene, but a place where you setup your code and then jump to a composer scene.

Rob

Hi Rob,

I tried removing line 4 [lua] local results = composer.gotoScene( “home” ) [/lua]

and I was still presented with the same issue, how do you suggest I go about fixing this issue?

Thanks again,

Matt.

Are you sure there are no other messages in your console log about missing images?

Also it looks like you’re trying to build a tab bar.  Is there a reason you’re doing it with newSwitch instead of newTabBar()?

Rob