Reputation: 31
I'm using a simple line of code in Corona to transition between scenes - the transition happens but the effect doesn't.
storyboard.gotoScene( "splash", "fade", 2000 )
I've compiled the build for the Xcode simulator to see if the fade effect would work there and it doesn't.
The complete code:
local storyboard = require "storyboard"
local scene = storyboard.newScene()
local SplashGroup = display.newGroup()
local function onBackgroundTouch()
storyboard.gotoScene("mainmenu", "fade", 2000)
end
--Called if the scene hasn't been previously seen
function scene:createScene (event)
local logoImage = display.newImage("RoxisLogo.png")
logoImage.x = display.contentWidth/2
logoImage.x = display.contentHeight/2
SplashGroup:insert(logoImage)
logoImage:addEventListener("tap", onBackgroundTouch)
end
function scene:enterScene(event)
SplashGroup.alpha=1
end
function scene:exitScene(event)
SplashGroup.alpha=0
end
--"createScene" is called whenever the scene is FIRST called
scene:addEventListener("createScene", scene)
--"enterScene event is dispatched whenever scene transition has finished
scene:addEventListener("enterScene", scene)
--"exitScene" event is dispatched before the next scene's transition begins
scene:addEventListener("exitScene", scene)
return scene
Upvotes: 0
Views: 1629
Reputation: 558
Use:
local group = self.view and add
group:insert( scene ) after creating scene's object.
Upvotes: 0
Reputation: 3317
One common misstake is that you forget to add your view elements to the self.view group. Often, storyboard templates includes local group = self.view
at the beginning of the scene:createScene
function. Try to insert your view objects into that group. Then retry your transitions.
Upvotes: 0
Reputation: 3063
I don't see where you are adding anything to the scene's view. Normally at the beginning of createScene and enterScene there is a line like this:
group = scene.view
This group is a display group and if you want storyboard to transition your scene on or off, you have to insert each display object into that group. You're creating your own group called localGroup, which is fine, but that group needs to be put into "group"
Also, things you do in createScene() happens off screen, then it's transitioned on screen. If you create your display objects in enterScene, they will just pop into view.
Finally you are setting the alpha in the enterScene and hiding it in the exitScene. This will kill any transitions too. I'd loose those alpha settngs install add those "group = scene.view" lines back inside your createScene() and enterScene() functions and add your objects to that group.
Upvotes: 1