Going to previous scene results in black screen

That error is now gone but now a new one popped up without me changing any code since the last post made by Rob Miracle. the error is: 

Runtime error

Scene 1 line 34: attempt to index local obj1 <a nill value? 

The second is also in scene one but no line is given is also appears 10 times in one go, line by line.

WARNING: attempting to set property <text> with nil.

Please see my answers here
http://stackoverflow.com/questions/16372428/corona-going-to-previous-scene-results-in-black-screen/16388993#16388993

First of all, calling destroyScene() isn’t something you should call.  It’s an event handler that gets called when the scene is destroyed.  You are not doing anything in your scene’s destroyScene any way.

Next you declare sceneGroup to be a display.newGroup() at the top, then in side of createScene() you are overwriting it, creating a small memory leak.  You just need to declare sceneGroup at the top:

local sceneGroup

I would also still like for you to do a print on the value of the previous scene to make sure you’re going to the right place.  Is the code above the scene you are leaving or the scene you are going to?

I will do a print when i get onto my main computer, to answer you question the code above is the scene i am leaving to go to the main menu, if the user decides to play the game and gets the answer correct it goes to scene 2 which works. You may want the main menu code too as that is where the problem occurs going to the previous scene = black screen:

--requires local storyboard = require ( "storyboard" ) local scene = storyboard.newScene() --load sound local click = audio.loadStream('click.wav') --create scene function scene:createScene(event) local screenGroup = self.view titleBg = display.newImage('titleBg2.png') titleBg.x = display.contentWidth / 2 titleBg.y = display.contentHeight / 2 startBtn = display.newImage('play.png') startBtn.x = display.contentCenterX startBtn.y = display.contentCenterY + 20 playtext = display.newText("PLAY", 142, 252, "ARIAL", 16) titletext = display.newText("1 CLUE 1 WORD", 85, 150, "ARIAL", 20) screenGroup:insert(titleBg) screenGroup:insert(startBtn) screenGroup:insert(playtext) screenGroup:insert(titletext) end function scene:enterScene(event) local group = self.view local function onSceneTouch( event ) if event.phase == "ended" then audio.play(click) local previousScene = storyboard.getPrevious() if previousScene == nil then storyboard.gotoScene( "scene1", "slideLeft", 750 ) else storyboard.gotoScene(previousScene) return true end end end function startButtonListeners(action) if(action == 'add') then startBtn:addEventListener('touch', onSceneTouch) end end startButtonListeners('add') end function scene:exitScene( event ) local group = self.view end function scene:destroyScene( event ) local group = self.view end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene

I did a print on the value of the previous scene and it matches the place it is supposed to go to. destroyScene() is removed and i did the local sceneGroup you said to do and I still get a blank screen.

After all this time i have found a “temporary” fix it was to create another main menu that the player returns to from there they can goto the previous scene they were on, however it is a temporary fix and not permanent. From the info i have gathered i suspect it must be something to do with this line of code:

local previousScene = storyboard.getPrevious() if previousScene == nil then storyboard.gotoScene( "scene1", "slideLeft", 750 ) else storyboard.gotoScene(previousScene)

I will need a permanent fix as this will not be efficient in the long run.

Is this a bug since when the user goes back to the second main menu i made and clicks play again it will also goto a black screen :frowning:

I noticed today when i started my app up that i got a warning in the console saying:

WARNING: failed to create audio sound<click.wav>

any thoughts?

That error is now gone but now a new one popped up without me changing any code since the last post made by Rob Miracle. the error is: 

Runtime error

Scene 1 line 34: attempt to index local obj1 <a nill value? 

The second is also in scene one but no line is given is also appears 10 times in one go, line by line.

WARNING: attempting to set property <text> with nil.