On I though I had found a work around to do the tasks in parallel (play the sound file as the object is animating using the onStart Parametre of transition.to but in doing so now seem to have a problem with the completion listener of media.playEventSound
local function playAAAEA()
print("***You have entered the playAnswerAudioandEffectAudio()")
if g_AnswerAudio == 1 then --if audio answer is enabled
local function playEffect()
print("***You have entered the playEffect()")
media.playEventSound(answerEffectAudioG[currentPageNo][clueRandNo])
end
if g_AnswerEffectAudio == 1 then --if audio effect is on
media.playEventSound(speakAnswerG[currentPageNo][clueRandNo],playEffect)
else
media.playEventSound(speakAnswerG[currentPageNo][clueRandNo])
end
end
end
local function playDoorOpenSound()
print("***You have entered the playDoorOpenSound()")
media.playEventSound( flapOpenSID, playAAAEA())
–playAAAEA()
end
–media.playEventSound( flapOpenSID, playAAAEA)
–playAAAEA()
originalX = pageFlap.x – Record original x axis possition of flap
transition.to(pageFlap,{time=1500, x = pageFlap.x + pageFlap.width, onStart=playDoorOpenSound})
What happens as it currently stands is that the the sound flapOpenSID plays at the same time as the sound taken from the table answerEffectAudioG even thou the function playAAAEA is supposed to be called on complete of the sound file playback (I presume this is complete of playing the sound not on executing the code) because the two sounds answerEffectAudioG and answerEffectAudioG do in fact play sequentially and do not overlap and answerEffectAudioG is played from function playEffect() as a on completion listener.
Incidentally playEffect is called without () but in the piece of code
media.playEventSound( flapOpenSID, playAAAEA())
Calling the function playAAAEA will not work with ()
???
Thanks in advance
[import]uid: 5872 topic_id: 1737 reply_id: 5269[/import]