Hi Ksan,
the onBack listener is called. I get both the began and ended messages from this when I press the button.
Also why does the effect and time not work on calling the overlay?
Martin
Hi Ksan,
the onBack listener is called. I get both the began and ended messages from this when I press the button.
Also why does the effect and time not work on calling the overlay?
Martin
Can you try the following approach for the showOverlay with effects? I think this might work better. Lets tackle this first.
-- display scene overlay local options = { effect = "fromLeft", time = 2000 } storyboard.showOverlay( "quests", options )
I will, but is it just a bug and not worth me wasting my time? Can you get an overlay to show then hide?
PS I am on version 2100
Yup. Don’t think its a bug. Works for me. Try the method above for showing the overlay and lets see if that cures the effects. Maybe the way you call the overlay is upsetting something internally which might be affecting the closing. Lets see.
The storyboard.hideOverlay() has a known bug of not handling transitions.
Rob
tried your version but still no effects or timing.
Also still cannot get hideOverlay to hide.
I’m sorry but I have no other ideas. Suggest you post your complete code or as cut back as can still demonstrate the problem.
I’m not really in the mood to try and explain, but here is my function for pausing my game and showing an overlay:
[lua]
local function onpauseBtnRelease()
timer.performWithDelay(10, pauseWorld)
audio.play( BtnAffirm )
physics.pause()
Particles.Freeze()
LeftStick.isVisible = false
LeftStick.isHitTestable = false
transRect.isHitTestable = false
PTMBtn.isVisible = false
PTMBtn.isHitTestable = false
PTMBtnbgi.isVisible = false
game_HUDG.isVisible = false
local options =
{
effect = “flipFadeOutIn”,
time = 250,
isModal = true
}
storyboard.showOverlay( “PauseMenu”, options )
– the following event is dispatched once overlay is removed
function scene:overlayEnded( event )
print( "Overlay removed: " … event.sceneName )
LeftStick.isVisible = true
LeftStick.isHitTestable = true
transRect.isHitTestable = true
PTMBtn.isVisible = true
PTMBtn.isHitTestable = true
PTMBtnbgi.isVisible = true
game_HUDG.isVisible = true
end
scene:addEventListener( “overlayEnded” )
end
[/lua]
And here is my button release function, in ‘PauseMenu’:
[lua]
– ‘onRelease’ function for ‘resumeBtn’
local function onresumeBtnRelease()
audio.play( BtnAffirm );
physics.start()
Particles.WakeUp()
storyboard.hideOverlay( false, 500 )
end
[/lua]
Hope this helps.
-Saer
Thanks for trying Saer, I compared my code to yours and couldn’t see why mine still isn’t working
here is the code:
a) in game.lua - this is the listener for an onscreen button.
local function onQuest_Button(event)
local phase = event.phase
if (“began”== phase) then
local options = {effect = “fromLeft”, time = 4000, isModal = true}
storyboard.showOverlay( “quests”,options )
end
end
in quests.lua - this is the whole overlay file.
local storyboard = require(“storyboard”)
local widget=require (“widget”)
local scene = storyboard.newScene()
function onBack(event)
print (event.phase)
print (“inside onBack”)
if (“ended”== event.phase) then
storyboard.hideOverlay( false,500 )
end
end
function scene:createScene(event)
overlayGroup = display.newGroup() – was local but had scope problems??
questimage = display.newImageRect( “images/questbackground.png”, 900,900 )
questimage.x = display.contentWidth/2-300
questimage.y = display.contentHeight/2+50
overlayGroup:insert( questimage )
back_button = widget.newButton {
left = 500,
top = 700,
height=40,
width=120,
label = “Back”,
fontsize=12,
onEvent = onBack
}
overlayGroup:insert(back_button)
--image.touch = onSceneTouch
end
scene:addEventListener(“createScene”)
function scene:enterScene(event)
– local options = {
–
– effect = “fromLeft”,
– time = 500
–}
end
scene:addEventListener(“enterScene”)
function scene:overlayBegan(event)
end
scene:addEventListener(“overlayBegan”)
function scene:overlayEnded(event)
--overlayGroup=nil
end
scene:addEventListener( “overlayEnded” )
return scene
Not sure if this might be causing your Back button not hiding the overlay but I noticed you have storyboard.hideOverlay( false,500 ) . API doc says you have to have an effect and time together. You have no effect here. Can you try with nothing in there just for kicks? ie storyboard.hideOverlay()? Thanks
Uh, why are you not adding things to the scene’s view group? An overlay scene is a scene. That is in createScene there should be:
function scene:createScene(event)
local group = scene.view
If you don’t put things in that group then storyboard won’t manage them. You create your own display.newGroup() called overlayGroup. Storyboard isn’t managing overlayGroup and therefore there is nothing to hide.
Rob
Well done AGAIN Rob. All sorted, it was as you say the displaygroup.
As I hadn’t used overlay before I was nervous in case somehow the self.view linked to the other onscreen group and “played safe” by creating a new group. As you say OBVIOUSLY - the storyboard didn’t manage the new group.
All of the issues with effect, timing and disappearance go away.
Have a good xmas.
Martin