I have short audio files (3 secs long) that play() when the touch event is detected.
My problem is to not run the play() method again, until the current play() method has completed it’s process.
Here’s what I’ve attempted so far, with a variable that is set at zero.
local myFunSnd = audio.loadSound("myFunSound.mp3");
local SndRunning = 0; --sound is off when first loaded
function runSoundFunction(e)
if(e.phase=="began" and SndRunning==0) then
SndRunning = 1; --change variable to 1
audio.play(myFunSnd);
SndRunning = 0; --change back to 0, when sound is done
end
end
Runtime:addEventListener("touch", runSoundFunction)
Hopefully the snippet above makes sense for what I’m attempting to accomplish.
This doesn’t work. So I’m wondering if anyone has a clever alternative. [import]uid: 154122 topic_id: 27294 reply_id: 327294[/import]