Can't purge/remove scene..

I am having a problem with purging my game scene from the Game Over overlay… From the overlay, the menu button calls a function to go to the menu scene, and in the GameOver destroyScene function I have storyboard.purgeScene( "game" ). This results in this error:

Runtime error  
 ?:0: attempt to index field 'contentBounds' (a nil value)  
stack traceback:  
 [C]: ?  
 ?: in function '?'  
 ?: in function 'gotoScene'  
 ...jacob/Development/BalloonPop/BalloonPop/gameOver.lua:46: in function 'onRelease'  
 ?: in function <?:200>  
 ?: in function <?:229>  

What’s going on?

Thanks! [import]uid: 144504 topic_id: 33209 reply_id: 333209[/import]

To provide you with better answer to your problem you need to:

  • tell us the build number of your corona sdk
  • show us your code

I am using 2012.938 and I don’t have any problem with overlay, it’s probably in your code. [import]uid: 31508 topic_id: 33209 reply_id: 131949[/import]

Currently, I’m using 894… This is what my code looks like…

function gameOver:createScene( event )  
 local group = self.view  
 menu = widget.newButton{  
 id = "menu",  
 sheet = buttonSheet,  
 defaultIndex = (buttonsSheet:getFrameIndex("menu")),  
 overIndex = (buttonsSheet:getFrameIndex("menu-over")),  
 width = 138, height = 64,  
 left = 40, top = 175,  
 onRelease = function() storyboard.gotoScene( "menu", "fade", 400 ) end  
 }   
 group:insert( bk )  
 group:insert( menu )  
end  
  
-- Called immediately after gameOver has moved onscreen:  
function gameOver:enterScene( event )  
 local group = self.view  
  
end  
  
-- Called when gameOver is about to move offscreen:  
function gameOver:exitScene( event )  
 local group = self.view  
  
 if menu then  
 menu:removeSelf() -- widgets must be manually removed  
 menu = nil  
 end  
 storyboard.purgeScene( "arcade" )  
end  
  
function gameOver:destroyScene( event )  
 local group = self.view  
 if menu then  
 menu:removeSelf() -- widgets must be manually removed  
 menu = nil  
 end  
 storyboard.purgeScene( "arcade" )  
end  

It seems it doens’t like purging another scene while the current one is being purged or something of that sort… It works perfectly fine outside of the exitScene and destroyScene functions, i.e. in the onRelease function… [import]uid: 144504 topic_id: 33209 reply_id: 131959[/import]

To provide you with better answer to your problem you need to:

  • tell us the build number of your corona sdk
  • show us your code

I am using 2012.938 and I don’t have any problem with overlay, it’s probably in your code. [import]uid: 31508 topic_id: 33209 reply_id: 131949[/import]

Currently, I’m using 894… This is what my code looks like…

function gameOver:createScene( event )  
 local group = self.view  
 menu = widget.newButton{  
 id = "menu",  
 sheet = buttonSheet,  
 defaultIndex = (buttonsSheet:getFrameIndex("menu")),  
 overIndex = (buttonsSheet:getFrameIndex("menu-over")),  
 width = 138, height = 64,  
 left = 40, top = 175,  
 onRelease = function() storyboard.gotoScene( "menu", "fade", 400 ) end  
 }   
 group:insert( bk )  
 group:insert( menu )  
end  
  
-- Called immediately after gameOver has moved onscreen:  
function gameOver:enterScene( event )  
 local group = self.view  
  
end  
  
-- Called when gameOver is about to move offscreen:  
function gameOver:exitScene( event )  
 local group = self.view  
  
 if menu then  
 menu:removeSelf() -- widgets must be manually removed  
 menu = nil  
 end  
 storyboard.purgeScene( "arcade" )  
end  
  
function gameOver:destroyScene( event )  
 local group = self.view  
 if menu then  
 menu:removeSelf() -- widgets must be manually removed  
 menu = nil  
 end  
 storyboard.purgeScene( "arcade" )  
end  

It seems it doens’t like purging another scene while the current one is being purged or something of that sort… It works perfectly fine outside of the exitScene and destroyScene functions, i.e. in the onRelease function… [import]uid: 144504 topic_id: 33209 reply_id: 131959[/import]