need help "storyboard.gotoScene" not Work

“storyboard.gotoScene” not Work

but button it work can print text

how i can fix it ?

thanks

[lua]local storyboard = require “storyboard”

local resetReference = function( index )

end

local checkLocation = function( index )

end
end

end

else

return false
end
end

local createPuzzle = function()

end

local startDrag = function( event )

end

local scatterPuzzle = function()

end

– activate buttons
newPuzzleBtn.isActive = true
backBtn.isActive = true

isReady = true
Runtime:addEventListener( “touch”, startDrag )
end
end

end

local drawBackground = function()

end

function backMainMenu( event )

storyboard.gotoScene( “menu”, “fade”, 500 )

print(“it can Print”)

return true

end

local backButton = function()

backBtn = ui.newButton{
defaultSrc = “picMain/btn_menu.png”,
defaultX = 275,
defaultY = 100,
overSrc = “picMain/btn_menu.png”,
overX = 280,
overY = 100,
onEvent =backMainMenu,
id = “backBtn”,
text = “”,
font = “Helvetica”,
textColor = { 255, 255, 255, 255 },
size = 16,
emboss = false
}

backBtn.x = display.contentWidth*0.5 - 130 ; backBtn.y = display.contentHeight / 2 +465
screenGroup:insert( backBtn )

end

local createGlow = function()

end

local touchNewPuzzleBtn = function( event )
if event.phase == “release” and newPuzzleBtn.isActive then

newPuzzleBtn.isActive = false

number = nil
–showImageFinish.removeSelf()
nextPuzzle()

end
end

local appInit = function()

end

appInit()
end

loadNewPuzzle()

nextPuzzle = function()
---- Code
end

end[/lua] [import]uid: 169163 topic_id: 29817 reply_id: 329817[/import]

@contact.milkstudio
have u made “menu” scene in advance?

menuScene = storyboard.newScene( "menu" )

[import]uid: 25057 topic_id: 29817 reply_id: 119578[/import]

i have “menu” scene

“menu” - > “game” —some error–> “menu”

thanks [import]uid: 169163 topic_id: 29817 reply_id: 119580[/import]

@milkstudio
I think your code is not complete
I didn’t see your “menu” scene above
have u read this carefully?
http://docs.coronalabs.com/api/library/storyboard/index.html
or u should post much more completed code here.
try simple your code first. [import]uid: 25057 topic_id: 29817 reply_id: 119699[/import]

@OwenYang

Thanks, i think it’s complete code but i don’t sure

you can download Code here http://www.mediafire.com/?pny0z696lz4higp

Help me plz. [import]uid: 169163 topic_id: 29817 reply_id: 119736[/import]

@milkstudio
I guess i have found your problem
If u use storyboard.
your “scene” lua file must have this code
U can compare menu.lua and level3.lua
U did have in menu.lua but not in level3(not a scene),
so while u wanna go back to “menu” scene, cause level3 is not part of storyboard…
it would listen to your action

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


– 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
– “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 )
[/code] [import]uid: 25057 topic_id: 29817 reply_id: 119846[/import]

@OwenYang

Thanks,

but have any how to use it? if i don’t use storyboard [import]uid: 169163 topic_id: 29817 reply_id: 119852[/import]

@contact.milkstudio
have u made “menu” scene in advance?

menuScene = storyboard.newScene( "menu" )

[import]uid: 25057 topic_id: 29817 reply_id: 119578[/import]

i have “menu” scene

“menu” - > “game” —some error–> “menu”

thanks [import]uid: 169163 topic_id: 29817 reply_id: 119580[/import]

@milkstudio
I think your code is not complete
I didn’t see your “menu” scene above
have u read this carefully?
http://docs.coronalabs.com/api/library/storyboard/index.html
or u should post much more completed code here.
try simple your code first. [import]uid: 25057 topic_id: 29817 reply_id: 119699[/import]

@OwenYang

Thanks, i think it’s complete code but i don’t sure

you can download Code here http://www.mediafire.com/?pny0z696lz4higp

Help me plz. [import]uid: 169163 topic_id: 29817 reply_id: 119736[/import]

@milkstudio
I guess i have found your problem
If u use storyboard.
your “scene” lua file must have this code
U can compare menu.lua and level3.lua
U did have in menu.lua but not in level3(not a scene),
so while u wanna go back to “menu” scene, cause level3 is not part of storyboard…
it would listen to your action

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


– 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
– “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 )
[/code] [import]uid: 25057 topic_id: 29817 reply_id: 119846[/import]

@OwenYang

Thanks,

but have any how to use it? if i don’t use storyboard [import]uid: 169163 topic_id: 29817 reply_id: 119852[/import]