# Stop/start button sound plays over itself

**URL:** <https://forum.kirupa.com/t/stop-start-button-sound-plays-over-itself/166266>\
**Category:** Uncategorized\
**Created:** [October 18, 2005, 2:41pm UTC](https://forum.kirupa.com/t/stop-start-button-sound-plays-over-itself/166266 "2005-10-18T14:41:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lindaabby](https://avatars.discourse-cdn.com/v4/letter/l/f14d63/32.png) [@lindaabby](https://forum.kirupa.com/u/lindaabby)\
**Post date:** [October 18, 2005, 2:41pm UTC](https://forum.kirupa.com/t/stop-start-button-sound-plays-over-itself/166266/1 "2005-10-18T14:41:52Z")

</div>

Hello Evenyone,

I am new to the forum. I am using a 30 sec sound file. I want it to play when the site starts and turn off when the button is hit.

The sound starts when the site starts up however, the first time the sound off button is hit the sound plays over itself-- like two songs are playing. The second time the button is hit the problem seems to go away.

Here is are the steps and code I used. I would appreciate someone giving me better code to use to create on/off buttons and loading sound or helping me with my existing code.

Did following to sound file:  
Selected: Linkage  
Selected: Export for Actionscript

Created layer named music  
Added the following actionscript in keyframe 1  
my\_sound = new Sound();  
my\_sound.attachSound('jazz");  
my\_sound.start(0,1000);  
gotoAndStop(“stop”);

In keyframe 2;  
Added a stop();  
Added a name for the frame called ‘play’

In keyframe 3:  
Added a stop();  
Added a name for the frame called ‘stop’

Dragged ‘on’ button to frame 2 with following actionscript:  
on (release) {  
\_root.my\_sound.start(0,1000);  
\_root.gotoAndStop(“stop”);  
}

Dragged ‘off’ button to frame 3 with following actionscript:  
on (release) {  
\_root.my\_sound.stop();  
\_root.gotoAndStop(“play”);  
}

I would appreciate any help…I’m not too familiar with sound files and how to control them.

Thanks.

Lindaabby
