Link to home
Start Free TrialLog in
Avatar of Neil_2004
Neil_2004

asked on

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.attachSound(j);
      newSound.start(13, 1);
      
      do {      
            
            newSound.onSoundComplete = function() {
                  i = i+1;                  
                  j = _root.sounds[i];
                  newSound = new Sound(this);
                  newSound.attachSound(j);
                  newSound.start(0, 1);
            };
            
      } while (i<50);
}
ASKER CERTIFIED SOLUTION
Avatar of negatyve
negatyve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Neil_2004
Neil_2004

ASKER

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

Regards

Neil

p.s. i'll probably be on here frequently asking questions about flash