# Having Trouble Attaching Sound To Button!

**URL:** <https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665>\
**Category:** flash\
**Created:** [November 26, 2002, 4:09am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665 "2002-11-26T04:09:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelly\_Nunes](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@Kelly\_Nunes](https://forum.kirupa.com/u/Kelly_Nunes)\
**Post date:** [November 26, 2002, 4:09am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665/1 "2002-11-26T04:09:22Z")

</div>

Hey there Fellow Flashers,

I am trying to attach a sound to a button, but I do not want to have the sound on the timeline. In other words I am trying to have the sound triggered via action script.

I know the code should be something similar to the following:

on (release) {  
Sound = new Sound();  
sound.attachSound(“seagulls”);  
}

However, I’m not quite sure this is right. Well, I know it’s not right because my sound is not working…

Anyway, if there’s anyone out there that can be of assistance please let me know.

Thanks,

Kelly

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 26, 2002, 4:24am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665/2 "2002-11-26T04:24:31Z")

</div>

would it b anything like this…  
[http://www.kirupaforum.com/showthread.php?s=&threadid=9670](http://www.kirupaforum.com/showthread.php?s=&threadid=9670)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 26, 2002, 4:25am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665/3 "2002-11-26T04:25:03Z")

</div>

So you have your sound set in the linkage properties?

Open up your library, right click on your sound file, the choose “linkage”, then check “Export for Actionscript” then in the name box put “seagulls” (no quotes).

[edit]hey would you look at that… a recent thread with the same subject… that coulda saved me some explaining…lol, thanks slayerment [/edit]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 26, 2002, 4:32am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665/4 "2002-11-26T04:32:58Z")

</div>

Hey Beta.

I I did that with the linkage and it still didn’t work. what I’m trying to do is get a sound to play on release. Not sure why it’s not working???

Thanks,

Kelly

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 26, 2002, 4:34am UTC](https://forum.kirupa.com/t/having-trouble-attaching-sound-to-button/8665/5 "2002-11-26T04:34:57Z")

</div>

```auto
on (release) {
mySound = new Sound();
mySound.attachSound("seagulls");
mySound.start(0, 99);
}

```

Try that 🙂

Now defining the new Sound() object each on Release doesn’t make sense, so you can put it on the \_root timline and have your button code look like this…

```auto
on (release) {
_root.mySound.attachSound("seagulls");
_root.mySound.start(0, 99);
}

```
