Hello again,
I have a problem where a transition and a sound should play together, but the function should proceed after the sound has finished playing.
The fact is on the Corona SDK everything works, on the iPhone I get the sound to play but not the animation, or have everything completely froze.
I tried to tweak it in dozen of ways with coroutines and delays and stuff, still working on Corona and not on the iPhone. Any help?
-- correct answer + transition function screen:correctAnswer() function transitionFinished() flashcard:setTextColor( 255, 255, 255 ) -- white screen:setCard() screen:resume() end function popFinished() flashcard.tween = transition.to(flashcard, {xScale = 1, yScale = 1, time = 200}) --, onComplete=transitionFinished end screen:wait() -- play sound if sound then if voice then local voiceSound = audio.loadSound( card.name .. ".aiff") local time = audio.getDuration( voiceSound ) co = coroutine.create(function () timer.performWithDelay( time, transitionFinished ) end) coroutine.resume(co) local audioChannel = audio.play( audio.loadSound( voiceSound) ) --, { onComplete=transitionFinished } else local audioChannel = audio.play( coinSound, { onComplete=transitionFinished } ) end end if card.guesses \> 0 then card.guesses = card.guesses - 1 end screen:update() screen:saveIt() flashcard:setTextColor( 0, 255, 0 ) -- green flashcard.tween = transition.to(flashcard, {xScale = 1.2, yScale = 1.2, time = 100, onComplete=popFinished}) end