External mp3 problem

I got help for linking the external mp3s as the user click on them. But there are 5 mp3s on the page, all named and called with instant names. When I click on the ifrst one, it starts playing. But when I press another one, the first song does not stop playing, I can keep on clicking and listen to five songs at the same time. What’s the code to have only one song playing at once?

IF u could post some code or and example FLA i could take a look and see what code is needed to stop the sounds.

Well to stop and immediately start another song you can use stopAllSound(); and immediately after that start playing any other song.

There are better ways then stop all sound. Stop all sound will stop every sound in your SWF including buttons sounds or any other sound u have going on. are u loading the MP3’s with streaming sound or in another SWF in to a layer or level?

well, sintax is right, but it depends either way how your loading and playing your sound…are you using a sound object or are you placing the sound on the timeline?? very important…

you can specify which sound to stop using the mySound.stop() function…

Yeah that’s true, but the chance that there will actually be a sound playing when stopAllSounds(); is called, is very small. And since another sound starts playing immediately, the user won’t even notice it.

Well are u using the sound object?

the code for the button to start playing the songs is

on(release){
x = new Sound();
x.loadSound(myName+".mp3",true);
x.start();
}

It’s a band’s site where I am supposed be able to listen if I click on them, and download them if I want to. And there is no other sound at all, it’s only the mp3s.

*Originally posted by outro_lugar *
**the code for the button to start playing the songs is

on(release){
x = new Sound();
x.loadSound(myName+“.mp3”,true);
x.start();
}

It’s a band’s site where I am supposed be able to listen if I click on them, and download them if I want to. And there is no other sound at all, it’s only the mp3s. **

whats the problem?

I got help for linking the external mp3s as the user click on them. But there are 5 mp3s on the page, all named and called with instant names. When I click on the ifrst one, it starts playing. But when I press another one, the first song does not stop playing, I can keep on clicking and listen to five songs at the same time. What’s the code to have only one song playing at once?

[AS]
x = newSound();
x.loadSound(“my.mp3”,true)
if(playing!=true){// if the song isnt playing
x.start();
playing = true;//declare the song as playing
}
[/AS]

when playing = true the sound will not start

I want whatever that was playing to stop and let the new clicked on one to start playing. So I don’t want the sound not to start. It’s like a playlist, ther are 5 songs, so I click on one, listen to it a little bit, then decide to hear another one. Thats when the problem happens - I want whatever else was playing to stop if any of the other songs are clicked on. So, I’m not sure not starting it is what I’m trying to do.

[AS]
x.stop();
[/AS]

that will stop sound object x.

so a button that loads a new sound file should obviously stop the other one, correct? think about it how is a sound going to stop unless you stop it

the code i gave you is so that once a song is playing you can’t load that same sound over the exisiting one

yess, i get it, it worked - thank you soooooo much!

no problem