Storyboard effects only working sporadically

I wasn’t sure whether or not to put this in the Storyboard forum or not, but I just started trying out the Corona Starter SDK so I hope it’s alright posting in this one.
 
I’m trying to wrap my head around why

[lua]storyboard.gotoScene( “menuScene”, “fade”, 400 )[/lua]

works when I use it in main.lua, but when I use it in menuScene.lua through a button press

[lua]local function onButtonRelease( event )

    local phase = event.phase

    if “ended” == phase then

        print(“You pressed and released a button!”)

        storyboard.gotoScene(“gameScene”, “fade”, 400)

    end

end[/lua]

or a number of other ways I only get the scene change and not the effect. I’ve tried having an options function like in the API Docs, and using different effects, but it always just pops into the new scene regardless of what I do. I’m not getting any errors either. Is there something I’m missing?

I came across this problem too. I was not adding my display objects to a group, so they were not getting removed properly and the new objects in the next scene would appear over the objects of the last scene. If you have the same background in both scenes this is easy to miss.

Add all your display objects to a group e.g.

screenGroup = self.view background = display.newImage("someImage.png", 0, 0) screenGroup:insert( background )

the transitions should work then

Thank you! That was driving me insane. It turns out I forgot to add the background to the new scene’s group.

It is an easy mistake to make, it has caught me out a few times!!

Also if you create your objects in the enterScene() function that won’t happen until AFTER the scene is transitioned on screen.  If you want transitions to work, do your creating in createScene()

I came across this problem too. I was not adding my display objects to a group, so they were not getting removed properly and the new objects in the next scene would appear over the objects of the last scene. If you have the same background in both scenes this is easy to miss.

Add all your display objects to a group e.g.

screenGroup = self.view background = display.newImage("someImage.png", 0, 0) screenGroup:insert( background )

the transitions should work then

Thank you! That was driving me insane. It turns out I forgot to add the background to the new scene’s group.

It is an easy mistake to make, it has caught me out a few times!!

Also if you create your objects in the enterScene() function that won’t happen until AFTER the scene is transitioned on screen.  If you want transitions to work, do your creating in createScene()