Story Board Question

I dont know if I have been looking at this code to long and missing it or what. I am just wondering if someone can find something that I am missing.

I am getting the following error in the corona simulator.

Runtime error  
 ?:0: attempt to index a nil value  
stack traceback:  
 [C]: ?  
 ?: in function '?'  
 ?: in function <?:215>  
2011-12-17 09:35:58.293 Corona Simulator[3743:903] glError at end unbindRenderFBO  
Runtime error  
 ?:0: attempt to index a nil value  
stack traceback:  
 [C]: ?  
 ?: in function '?'  
 ?: in function <?:215>  

Here is my code. i have been trying to figure this out and it. Thanks for your help!

[code]


– index.lua


local storyboard = require( “storyboard” )
local scene = storyboard.newScene()

local playButton
– Touch event listener for start button
local function buttonTouch( self, event )
if event.phase == “began” then

storyboard.gotoScene( “match”, “slideLeft”, 800 )

return true
end
end

– Called when the scene’s view does not exist:
function scene:createScene( event )
local screenGroup = self.view

playButton = display.newImageRect( “play.png”, 276, 188 )
playButton.x = _W/2
playButton.y = _H/2

screenGroup:insert( playButton )

playButton.touch = buttonTouch
print( “showing start” )

end

– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
– remove revious scene view index
playButton:addEventListener ( “touch”, playButton )
end

– Called when scene is about to move offscreen:
function scene:exitScene( event )
playButton:removeEventListener( “touch”, playButton )
end

– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
print( “((killing scene view))” )
end


– END OF YOUR IMPLEMENTATION

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )


return scene
[/code] [import]uid: 73307 topic_id: 19285 reply_id: 319285[/import]

Hi,

i’ve been playing with your code and everything seems to be fine!
I think your problem might be in you main.lua or the match.lua file.

I was using a main.lua with only[lua]storyboard = require “storyboard”
_W = display.contentWidth;
_H = display.contentHeight;
storyboard.gotoScene(“index”);[/lua]without any problem. No error in the console at all.

Are you receving this error message when switching from main to index? Or is it when clicking the Play button?
Make sure to add print() statements in your code so that you know exactly when the error happens.

Keep us updated! [import]uid: 69375 topic_id: 19285 reply_id: 74402[/import]