Hey there, cheers for reading my post. I have written a simple function that should check if a bunch of other sound objects are playing and then play the sound object it is targeted at when the other sounds have finished by triggering the function again. I am storing whether the other sounds are playing in boolean variables. For some reason my code isn’t working and I can’t for the life of me figure out why. If someone would have a look that woulde be excellent. Thanks!
function PlayNumber(no) {
trace("Play Number Called");
if (soundOn) {
if (welcomePlaying) {
trace("welcomePlaying");
Welcome.onSoundComplete = function() {
welcomePlaying = false;
trace("welcome finished")
PlayNumber(no);
};
} else if (fHPlaying) {
trace("FHPlaying");
FHStart.onSoundComplete = function() {
fHPlaying = false;
PlayNumber(no);
};
} else if (linePlaying) {
trace("line PLaying");
LineStart.onSoundComplete = function() {
PlayNumber(no);
};
} else if (numberPlaying) {
trace("number Playing");
numbers[lastNumber].onSoundComplete = function() {
PlayNumber(no);
};
} else {
trace("nothing playing");
numbers[no].start();
numberPlaying = true;
numbers[no].onSoundComplete = function() {
numberPlaying = false;
};
}
}
}
function playWelcome(){
welcome.start()
welcomePaying = true;
welcome.onSoundFinished = function(){
welcomePLaying = false;
}
}