I’ve probably made a stupid mistake here, but cannot for the life of me figure it out. When I run the following:
[lua]
function scene.tapButton( event )
storyboard.gotoScene( event.target.destination, “fade”, 500 )
end
function scene.createButton( imageDirectory, destinationScene )
local button = display.newImage( imageDirectory )
button.destination = destinationScene
button:addEventListener( “tap”, scene.tapButton )
end
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
local startButton = scene.createButton( “startButton.png”, “gameScene” )
group:insert( startButton )
end
[/lua]
I get this error: “ERROR: table expected. If this is a function call, you might have used ‘.’ instead of ‘:’”
Commenting out “group:insert( startButton )” makes the code viable, but then the start button is not part of the scene.view (sad times). After some reading it seems the issue is that my startButton is not a valid display object. But I don’t see why not? Or is there another issue I am not seeing?