# Queing sounds to be played

**URL:** <https://forum.kirupa.com/t/queing-sounds-to-be-played/192142>\
**Category:** flash\
**Created:** [June 26, 2006, 3:39pm UTC](https://forum.kirupa.com/t/queing-sounds-to-be-played/192142 "2006-06-26T15:39:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![schmichael](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@schmichael](https://forum.kirupa.com/u/schmichael)\
**Post date:** [June 26, 2006, 3:39pm UTC](https://forum.kirupa.com/t/queing-sounds-to-be-played/192142/1 "2006-06-26T15:39:52Z")

</div>

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!

```auto
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;

    }
}

```
