flash cs3 playlist

How to build a play list on flash cs3 using the list as toggle buttons?
Hi, I need  to crate a flash file that will served as a soundtrack.
I have a list of 9 titled songs converted each one into buttons. All I want is to make each button play the sample audio belonging to the song title. I manage to make it play but I have more than one so my problem is that I need for each button to turn off the previous first and then play the new audio in case user switches to next song before the first one ends.

This is my code sample for just 2 buttons so far:
mySound = new Sound();
mySound.attachSound("parriba");

song1_btn.onRelease = function() {
      mySound.start();

}

mySound = new Sound();
mySound.attachSound("lloroporti");

song2_btn.onRelease = function() {
      mySound.start();
}
Picture-18.png
Mlo-DesignsAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

blue-genieCommented:
this should work

//as2
function playSound(which:String) {
var mySound:Sound = new Sound();
stopAllSounds();
mySound.attachSound(which);
mySound.start();
}
 
btn1.onRelease =function() {
playSound("a");
}
btn2.onRelease = function() {
playSound("b");
}

Open in new window

0

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
Mlo-DesignsAuthor Commented:
OMG- Worked like a charm. Thank You Very Much
0
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
Web Development Software

From novice to tech pro — start learning today.