# Need Help with 'if' statement

**URL:** <https://forum.kirupa.com/t/need-help-with-if-statement/259755>\
**Category:** flash\
**Created:** [May 8, 2008, 1:24pm UTC](https://forum.kirupa.com/t/need-help-with-if-statement/259755 "2008-05-08T13:24:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alla\_k](https://avatars.discourse-cdn.com/v4/letter/a/839c29/32.png) [@alla\_k](https://forum.kirupa.com/u/alla_k)\
**Post date:** [May 8, 2008, 1:24pm UTC](https://forum.kirupa.com/t/need-help-with-if-statement/259755/1 "2008-05-08T13:24:26Z")

</div>

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:

```auto
 
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!!!

---

<div class="post-metadata">

**Author:** ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)\
**Post date:** [May 12, 2008, 2:44am UTC](https://forum.kirupa.com/t/need-help-with-if-statement/259755/2 "2008-05-12T02:44:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jitu78](https://avatars.discourse-cdn.com/v4/letter/j/258eb7/32.png) [@jitu78](https://forum.kirupa.com/u/jitu78)\
**Post date:** [May 12, 2008, 7:12am UTC](https://forum.kirupa.com/t/need-help-with-if-statement/259755/3 "2008-05-12T07:12:17Z")

</div>

[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](http://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
