# Trouble with sound using Actionscript

**URL:** https://forum.kirupa.com/t/trouble-with-sound-using-actionscript/207787
**Category:** flash
**Created:** [November 21, 2006, 2:56pm UTC](https://forum.kirupa.com/t/trouble-with-sound-using-actionscript/207787 "2006-11-21T14:56:29Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![larsen2000](https://avatars.discourse-cdn.com/v4/letter/l/cdc98d/32.png) [@larsen2000](https://forum.kirupa.com/u/larsen2000)
#### Post date: [November 21, 2006, 2:56pm UTC](https://forum.kirupa.com/t/trouble-with-sound-using-actionscript/207787/1 "2006-11-21T14:56:29Z")

</div>

I’m using this script to play sounds when hitting a playbutton:

[FONT=Courier New][SIZE=2] [COLOR=Black]on (release) {[/COLOR]  
[COLOR=Black] mySound = new Sound(this);  
mySound.attachSound(“soundfile”);  
mySound.start(0, 1);  
}

How can I make this script better so the soundfile will not start over and over again when hitting the playbutton?

[/COLOR][/SIZE][/FONT]
