is there a way to delay executing changeScene function? I have a scenario where I have to play an audio before moving to the next scene but the next scene also has an audio too. Right now, when I execute the changeScene function I get audio overlap. So, how do I complete the audio from scene1 before transitioning to scene2
example of what I have right now:
[code]
local imageTouched = function ( event )
if event.phase == “began” then
transition.to(circle, {time=100, xScale = 1.5, yScale = 1.5})
audio.play(soundYesYouGotIt);
elseif event.phase == “ended” then
transition.to(circle, {time=100, xScale = 1, yScale = 1})
director:changeScene( “question2”, “downFlip” )
end
end
Hmm… No response… So did I ask a dumb question here :-)? Anyway, I tried using the timer before changing the scene. Didn’t help. It should be something simple. Let the audio finish then change the scene. Still scratching my head… [import]uid: 46630 topic_id: 21413 reply_id: 85076[/import]
in case someone is struggling with the same problem… here is how I was able to get it working
local imageTouched = function ( event )
if event.phase == "began" then
transition.to(circle, {time=100, xScale = 1.5, yScale = 1.5})
audio.play(soundYesYouGotIt);
elseif event.phase == "ended" then
transition.to(circle, {time=100, xScale = 1, yScale = 1})
local function goToNextScene()
director:changeScene("question2", "downFlip" )
end
timer.performWithDelay ( 1000, goToNextScene )
end
end
it’s kind of funny but it works [import]uid: 46630 topic_id: 21413 reply_id: 85423[/import]