onSoundComplete... how do i get it to work

i have made a page containing several pictures, when the pictures are clicked they play a sound.  Next to each picture is a button which, when clicked, writes the name of the sound to an array, all of this works fine but when i push the button to play each sound in order, using the code below in particular the  "newSound.onSoundComplete = function() {" line, the code never goes through it.  i'm probably just missing something but i cannot think of anything. Can anybody help?????

on (click) {
      i = 0;
      j = _root.sounds[i];
      var newSound:Sound = new Sound(this);
      newSound.start(13, 1);
      do {      
            newSound.onSoundComplete = function() {
                  i = i+1;                  
                  j = _root.sounds[i];
                  newSound = new Sound(this);
                  newSound.start(0, 1);
      } while (i<50);
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

on (click) {
      var i = -1;
      newSound = new Sound();
      newSound.onSoundComplete = function()
            if(i < _root.sounds.length - 1){
                  i = i + 1;
                  this.start(0, 1);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil_2004Author Commented:
i put an if statement around the bottom onSoundComplete to stop it from repeating for the length of the array but it works perfectly.  I must not be up to scratch on this language at all.
Thank you very much for your help negatyve



p.s. i'll probably be on here frequently asking questions about flash
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.