I’m trying to write a simple app, and although I have used Storyboard before I dont know why this app doesnt want to work. Previous apps still work so the problem is most certainly with the code. I get the following errors when I run, the strangest being the first warning since I never declared any oldscene.jpg:
Warning: Failed to find image(oldscene.jpg)
Runtime error
?:0 attempt to index a nil value
stack traceback:
[C]:?
?: in function ‘?’
?: in function ‘gotoScene’
[code]
–
– scenetemplate.lua
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
–
– NOTE:
– Code outside of listener functions (below) will only be executed once,
– unless storyboard.removeScene() is called.
– BEGINNING OF YOUR IMPLEMENTATION
– Called when the scene’s view does not exist:
function scene:createScene( event )
local group = self.view
local pageText = display.newText (“Hello World”, 0, 0, native.systemFont, 28)
pageText.x = display.contentWidth * 0.5
pageText.y = display.contentHeight - (display.contentHeight*0.95)
local object = display.newImage( “fdmnov11.png” )
object.id = “ball object”
object.x = display.contentCenterX
object.y = display.contentCenterY
local function onObjectTouch( event )
if event.phase == “began” then
print( "Touch event began on " )
storyboard.gotoScene( “articles”)
end
return true
end
object:addEventListener( “touch”, onObjectTouch )
– CREATE display objects and add them to ‘group’ here.
– Example use-case: Restore ‘group’ from previously saved state.
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
– INSERT code here (e.g. start timers, load audio, start listeners, etc.)
end
– Called when scene is about to move offscreen:
function scene:exitScene( event )
local group = self.view
– INSERT code here (e.g. stop timers, remove listeners, unload sounds, etc.)
end
– Call*ed prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
local group = self.view
– INSERT code here (e.g. remove listeners, widgets, save state, etc.)
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: 76592 topic_id: 30538 reply_id: 330538[/import]