Need Help with 'if' statement

hi everyone,

i have a problem with my sound here. The sound has to be loaded as soon as the movie starts, but there are buttons in the movie that take it to the beginning of the timeline (they are necessary), so every time one of those buttons is pressed the sound starts playing all over again. But I only need it to be played once! Despite going back to the beginning of the timeline…

here is my code:

 
RingSound = new Sound(this);
RingSound.attachSound("ring.mp3");
RingSound.start(6);
this.ring.onRelease = function  () {
RingSound.stop();

basically, i need to add something that would prevent the sound from attaching itself again…i suppose an if statement but i’m not sure! Please help!!!

if (!played){
RingSound = new Sound();
RingSound.attachSound(“ring.mp3”);
RingSound.start(6);
played=true;
}

[quote=natronp;2324872]if (!played){
RingSound = new Sound();
RingSound.attachSound(“ring.mp3”);
RingSound.start(6);
played=true;
}[/quote]

Hi Natronp,

Nice way, I was doing it by another way.

I’ve one issue with my flash code for music palyer. It’s IE browser issue.
Please visit www.gigaturn.com, its my new work.

Go to flash work from top links and check music player.
There you will see some error/warning in IE, how can I fix it?

Thanks