Updated to current Daily build and storyboard seems broken

I’ve been using the latest Corona stable build since it was released and today I wanted to update my Corona to today’s daily build, unfortunately all the apps I’ve developed that used storyboard seem to be triggering this error once storyboard.gotoScene() is called:

2013-02-05 19:28:47.858 Corona Simulator[1258:f03] Runtime error
?:0: attempt to call method ‘dispatchEvent’ (a nil value)
stack traceback:
[C]: in function ‘dispatchEvent’
?: in function ‘gotoScene’
/…file.lua:45: in function ‘restart’
/…file.lua:242: in function
?: in function <?:218>

Did anything change in the meantime regarding the storyboard usage?
[import]uid: 151732 topic_id: 35650 reply_id: 335650[/import]

Perhaps it’s worth mentioning that both my apps were working as intended prior to this update. (2012.971 to 2013.1021) [import]uid: 151732 topic_id: 35650 reply_id: 141752[/import]

There have been quite a few fixes in both storyboard and widgets since 971. There wasn’t anything specific in 1021 related to storyboard. Can you post some code for us to look at? [import]uid: 199310 topic_id: 35650 reply_id: 141778[/import]

“main” relevant lines:

storyboard = require "storyboard"  
storyboard.purgeOnSceneChange = true  
storyboard.gotoScene( "game" )  

“game” relevant lines and structure:

local function restart()  
 storyboard.gotoScene( "transition", {effect = "crossFade",time = 250} )  
end  
  
function scene:createScene( event )  
 physics = require "physics"  
 physics.start(); physics.pause()  
 local group = self.view  
  
 group:insert( self.particleManager:getGroup() )  
 group:insert( self.scoreText )  
 group:insert( self.bestScoreText )  
 group:insert ( scene.statBoard )  
end  
function onCollision(event)  
--Do a bunch of thing if stuff collides  
end  
  
function scene:enterScene( event )  
 local group = self.view  
 --Reset some unrelated variables  
 Runtime:addEventListener( "enterFrame", loop )   
 Runtime:addEventListener( "collision", onCollision )  
end  
  
function scene:exitScene( event )  
 local group = self.view  
 physics.stop()  
  
 Runtime:removeEventListener( "enterFrame", loop )   
 Runtime:removeEventListener( "collision", onCollision )  
end  
  
function scene:destroyScene( event )  
 local group = self.view  
 --Remove some display objects and set them to nil  
 package.loaded[physics] = nil  
 physics = nil  
end  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

“transition” structure:

local scene = storyboard.newScene()  
  
function scene:createScene( event )   
 local group = self.view   
end  
  
function scene:enterScene( event )   
end  
  
function scene:exitScene( event ) end  
function scene:destroyScene( event ) end  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

The problem happens once that “restart” function runs… but a completely different code using the same logistics is also triggering that error.

PS: It won’t even run any of the create or enter scene listeners of the “transition” file [import]uid: 151732 topic_id: 35650 reply_id: 141784[/import]

I suspect that your problem is naming your scene “transition.lua”. There are examples of this error showing up previously who named their scene “credits” when we had a credits.* API library. Of course credits is being removed, but the advice was to rename the file to gamecredits.lua and change the storyboard.gotoScene() to call “gamecredits” instead of “credits”.

Well “transition” is a valid Corona internal library and when storyboard tries to do a require(“transition”) that module is already loaded and it won’t load your version and since it’s not a storyboard scene there is no function to dispatch too. Try renaming transition.lua to something else and the gotoScene() call that goes with it and see if that solves your problem.
[import]uid: 199310 topic_id: 35650 reply_id: 141789[/import]

Yep, once I renamed my file, everything started to work again.

Don’t know why it didn’t happen in earlier versions, but if it’s fixed, I’m happy :slight_smile:

Thanks, Rob! [import]uid: 151732 topic_id: 35650 reply_id: 141886[/import]

Perhaps it’s worth mentioning that both my apps were working as intended prior to this update. (2012.971 to 2013.1021) [import]uid: 151732 topic_id: 35650 reply_id: 141752[/import]

There have been quite a few fixes in both storyboard and widgets since 971. There wasn’t anything specific in 1021 related to storyboard. Can you post some code for us to look at? [import]uid: 199310 topic_id: 35650 reply_id: 141778[/import]

“main” relevant lines:

storyboard = require "storyboard"  
storyboard.purgeOnSceneChange = true  
storyboard.gotoScene( "game" )  

“game” relevant lines and structure:

local function restart()  
 storyboard.gotoScene( "transition", {effect = "crossFade",time = 250} )  
end  
  
function scene:createScene( event )  
 physics = require "physics"  
 physics.start(); physics.pause()  
 local group = self.view  
  
 group:insert( self.particleManager:getGroup() )  
 group:insert( self.scoreText )  
 group:insert( self.bestScoreText )  
 group:insert ( scene.statBoard )  
end  
function onCollision(event)  
--Do a bunch of thing if stuff collides  
end  
  
function scene:enterScene( event )  
 local group = self.view  
 --Reset some unrelated variables  
 Runtime:addEventListener( "enterFrame", loop )   
 Runtime:addEventListener( "collision", onCollision )  
end  
  
function scene:exitScene( event )  
 local group = self.view  
 physics.stop()  
  
 Runtime:removeEventListener( "enterFrame", loop )   
 Runtime:removeEventListener( "collision", onCollision )  
end  
  
function scene:destroyScene( event )  
 local group = self.view  
 --Remove some display objects and set them to nil  
 package.loaded[physics] = nil  
 physics = nil  
end  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

“transition” structure:

local scene = storyboard.newScene()  
  
function scene:createScene( event )   
 local group = self.view   
end  
  
function scene:enterScene( event )   
end  
  
function scene:exitScene( event ) end  
function scene:destroyScene( event ) end  
  
scene:addEventListener( "createScene", scene )  
scene:addEventListener( "enterScene", scene )  
scene:addEventListener( "exitScene", scene )  
scene:addEventListener( "destroyScene", scene )  
  
return scene  

The problem happens once that “restart” function runs… but a completely different code using the same logistics is also triggering that error.

PS: It won’t even run any of the create or enter scene listeners of the “transition” file [import]uid: 151732 topic_id: 35650 reply_id: 141784[/import]

I suspect that your problem is naming your scene “transition.lua”. There are examples of this error showing up previously who named their scene “credits” when we had a credits.* API library. Of course credits is being removed, but the advice was to rename the file to gamecredits.lua and change the storyboard.gotoScene() to call “gamecredits” instead of “credits”.

Well “transition” is a valid Corona internal library and when storyboard tries to do a require(“transition”) that module is already loaded and it won’t load your version and since it’s not a storyboard scene there is no function to dispatch too. Try renaming transition.lua to something else and the gotoScene() call that goes with it and see if that solves your problem.
[import]uid: 199310 topic_id: 35650 reply_id: 141789[/import]

Yep, once I renamed my file, everything started to work again.

Don’t know why it didn’t happen in earlier versions, but if it’s fixed, I’m happy :slight_smile:

Thanks, Rob! [import]uid: 151732 topic_id: 35650 reply_id: 141886[/import]