storyboard.hideOverlay doesn't recognize transition time

Hi,

I’m using the following code to hide the main menu in my adventure game:

[lua]storyboard.hideOverlay(true, “fade”, 1000)[/lua]

This is called from within the overlay itself. However, no matter what transition I use or value for time, the transition length is always visibly the default 500 ms. Is this a bug?

Thanks!

  • David
    [import]uid: 149111 topic_id: 31512 reply_id: 331512[/import]

Hmm, dunno? I started using overlays myself a few weeks without too much trouble. Just make sure that:

  • All objects in your overlay are inserted into the scene.view group

  • Your listeners are correctly specified

  • And that’s really all I can think of right now

If you paste more code, I’ll look at it later

[import]uid: 7721 topic_id: 31512 reply_id: 125899[/import]

@ETdoFresh: Thanks for the ideas. I cleaned up the code for the scene and everything looks in order, but still no luck. Oddly enough, changing the transition type works fine, but the duration is always 500 ms no matter what I set it to. Below I have it set to 5000 ms, which should be quite visually obvious.

Here’s the code to show the overlay:

[lua]storyboard.showOverlay(“rooms.main_menu”, {effect=“fade”, time=2000})[/lua]

Note that transition duration works when showing the overlay.

Here’s the entire overlay module:

[lua]-- Load storyboard and create the scene
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()

– Local variables
local startButton = nil
local settingsButton = nil

– Setup function
function scene:createScene (e)
local group = self.view

– Create the menu overlay group and elements
local menuOverlay = display.newGroup()
local dogginsTitle = display.newImageRect(“images/rooms/main_menu/Menu-Title.png”, 425, 44)
settingsButton = display.newImageRect(“images/rooms/main_menu/Menu-Settings.png”, 35, 35)

– If there is a game in progress, show the “Continue Adventure” button
if (gameSettings.gameInProgress == true) then
startButton = display.newImageRect(“images/rooms/main_menu/Menu-Continue.png”, 274, 54)
startButton:setReferencePoint(display.TopLeftReferencePoint)
startButton.x = 570; startButton.y = 393
else
startButton = display.newImageRect(“images/rooms/main_menu/Menu-Start.png”, 214, 54)
startButton:setReferencePoint(display.TopLeftReferencePoint)
startButton.x = 570; startButton.y = 393
end

function startButton:touch (e)
if (e.phase == “ended”) then
if (gameSettings.gameInProgress == true) then – Continue game
storyboard.gotoScene(“rooms.” … gameState.currRoom, “fade”, 1500)
else – New game
gameSettings.gameInProgress = true
storyboard.hideOverlay(“fade”, 5000)
end
end
end

– Set reference point for overlay elements
dogginsTitle:setReferencePoint(display.TopLeftReferencePoint)
settingsButton:setReferencePoint(display.TopLeftReferencePoint)

– Reposition overlay elements
dogginsTitle.x = 460; dogginsTitle.y = 321
settingsButton.x = 970; settingsButton.y = 715

– Insert elements into the overlay group
menuOverlay:insert(dogginsTitle)
menuOverlay:insert(startButton)
menuOverlay:insert(settingsButton)

– Position the overlay
menuOverlay:setReferencePoint(display.TopLeftReferencePoint)
menuOverlay.x = 460; menuOverlay.y = 321

– Insert the overlay into the scene
group:insert(menuOverlay)
end

function scene:enterScene (e)
startButton:addEventListener(“touch”, startButton)
end

function scene:exitScene (e)

end

– Cleanup function
function scene:destroyScene (e)

end

scene:addEventListener(“createScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“exitScene”, scene)
scene:addEventListener(“destroyScene”, scene)

return scene[/lua]

Thanks again for the help!

  • David [import]uid: 149111 topic_id: 31512 reply_id: 125920[/import]

I just remembered that I’m using storyboard.hideOverlay in my inventory module as well, and it too is ignoring the time I specify, while it does use the specified effect:

[lua]storyboard.hideOverlay(“slideRight”, 200)[/lua]

Either I’m repeatedly doing the wrong thing, or this is a larger bug. Probably the former. :slight_smile: [import]uid: 149111 topic_id: 31512 reply_id: 126082[/import]

Hmm, dunno? I started using overlays myself a few weeks without too much trouble. Just make sure that:

  • All objects in your overlay are inserted into the scene.view group

  • Your listeners are correctly specified

  • And that’s really all I can think of right now

If you paste more code, I’ll look at it later

[import]uid: 7721 topic_id: 31512 reply_id: 125899[/import]

@ETdoFresh: Thanks for the ideas. I cleaned up the code for the scene and everything looks in order, but still no luck. Oddly enough, changing the transition type works fine, but the duration is always 500 ms no matter what I set it to. Below I have it set to 5000 ms, which should be quite visually obvious.

Here’s the code to show the overlay:

[lua]storyboard.showOverlay(“rooms.main_menu”, {effect=“fade”, time=2000})[/lua]

Note that transition duration works when showing the overlay.

Here’s the entire overlay module:

[lua]-- Load storyboard and create the scene
local storyboard = require(“storyboard”)
local scene = storyboard.newScene()

– Local variables
local startButton = nil
local settingsButton = nil

– Setup function
function scene:createScene (e)
local group = self.view

– Create the menu overlay group and elements
local menuOverlay = display.newGroup()
local dogginsTitle = display.newImageRect(“images/rooms/main_menu/Menu-Title.png”, 425, 44)
settingsButton = display.newImageRect(“images/rooms/main_menu/Menu-Settings.png”, 35, 35)

– If there is a game in progress, show the “Continue Adventure” button
if (gameSettings.gameInProgress == true) then
startButton = display.newImageRect(“images/rooms/main_menu/Menu-Continue.png”, 274, 54)
startButton:setReferencePoint(display.TopLeftReferencePoint)
startButton.x = 570; startButton.y = 393
else
startButton = display.newImageRect(“images/rooms/main_menu/Menu-Start.png”, 214, 54)
startButton:setReferencePoint(display.TopLeftReferencePoint)
startButton.x = 570; startButton.y = 393
end

function startButton:touch (e)
if (e.phase == “ended”) then
if (gameSettings.gameInProgress == true) then – Continue game
storyboard.gotoScene(“rooms.” … gameState.currRoom, “fade”, 1500)
else – New game
gameSettings.gameInProgress = true
storyboard.hideOverlay(“fade”, 5000)
end
end
end

– Set reference point for overlay elements
dogginsTitle:setReferencePoint(display.TopLeftReferencePoint)
settingsButton:setReferencePoint(display.TopLeftReferencePoint)

– Reposition overlay elements
dogginsTitle.x = 460; dogginsTitle.y = 321
settingsButton.x = 970; settingsButton.y = 715

– Insert elements into the overlay group
menuOverlay:insert(dogginsTitle)
menuOverlay:insert(startButton)
menuOverlay:insert(settingsButton)

– Position the overlay
menuOverlay:setReferencePoint(display.TopLeftReferencePoint)
menuOverlay.x = 460; menuOverlay.y = 321

– Insert the overlay into the scene
group:insert(menuOverlay)
end

function scene:enterScene (e)
startButton:addEventListener(“touch”, startButton)
end

function scene:exitScene (e)

end

– Cleanup function
function scene:destroyScene (e)

end

scene:addEventListener(“createScene”, scene)
scene:addEventListener(“enterScene”, scene)
scene:addEventListener(“exitScene”, scene)
scene:addEventListener(“destroyScene”, scene)

return scene[/lua]

Thanks again for the help!

  • David [import]uid: 149111 topic_id: 31512 reply_id: 125920[/import]

I just remembered that I’m using storyboard.hideOverlay in my inventory module as well, and it too is ignoring the time I specify, while it does use the specified effect:

[lua]storyboard.hideOverlay(“slideRight”, 200)[/lua]

Either I’m repeatedly doing the wrong thing, or this is a larger bug. Probably the former. :slight_smile: [import]uid: 149111 topic_id: 31512 reply_id: 126082[/import]

This is a bug, your not doing anything wrong.

The fix should be available (along with lots more storyboard & widget fixes) in daily build 928
Thanks for your patience. [import]uid: 84637 topic_id: 31512 reply_id: 126315[/import]

@Danny: That’s great news! Looking forward to it. Thanks! [import]uid: 149111 topic_id: 31512 reply_id: 126321[/import]

This is a bug, your not doing anything wrong.

The fix should be available (along with lots more storyboard & widget fixes) in daily build 928
Thanks for your patience. [import]uid: 84637 topic_id: 31512 reply_id: 126315[/import]

@Danny: That’s great news! Looking forward to it. Thanks! [import]uid: 149111 topic_id: 31512 reply_id: 126321[/import]