I am creating a main menu and I want to handle my scenes with storyboard.
Here is my main.lua:
-- Hide status bar
display.setStatusBar(display.HiddenStatusBar);
-- Some global variables
local assetsPath = "media/"
local lettersPath = "media/letters/"
-- Initialize storyboard
local storyboard = require ("storyboard")
local widget = require("widget")
-- Load first scene
storyboard.gotoScene("splashscene")
and here is my splashscene.lua:
local storyboard = require("storyboard") local scene = storyboard.newScene()local bgimg, moratechlogo,text
local function onSceneTouch(self,event)
if event.phase == "began" then storyboard.goToScene("mainmenuscene", "fade", 400) return true end
end
function scene:createScene(event)
local screenGroup = self.view bgimg = display.newImage("media/splashBG.png",0,0) moratechlogo = display.newImage("media/moratechgames.png", display.contentWidth/2 - 150, display.contentHeight/2 - 100) screenGroup:insert(bgimg) screenGroup:insert(moratechlogo) moratechlogo.touch = onSceneTouch text = display.newText("Tap here to continue...", display.contentWidth /2 - 76, display.contentHeight - 30) text:setTextColor(255) screenGroup:insert(text) text.touch = onSceneTouch
end
function scene:enterScene( event ) local screenGroup = self.view
end
function scene:exitScene( event )
-- remove touch listener for image text:removeEventListener( "touch", text ) moratechlogo:removeEventListener("touch",moratechlogo) end function scene:destroyScene( event ) end scene:addEventListener( "createScene", scene ) scene:addEventListener( "enterScene", scene ) scene:addEventListener( "exitScene", scene ) scene:addEventListener( "destroyScene", scene ) return scene
But when I click/touch the text and/or the logo it doesn't transit to mainmenuscene.lua Any idea why?