# \[AS3\] Play sound on click of a button

**URL:** https://forum.kirupa.com/t/as3-play-sound-on-click-of-a-button/200333
**Category:** flash
**Created:** [September 11, 2006, 10:18am UTC](https://forum.kirupa.com/t/as3-play-sound-on-click-of-a-button/200333 "2006-09-11T10:18:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![v\_gyku](https://avatars.discourse-cdn.com/v4/letter/v/f19dbf/32.png) [@v\_gyku](https://forum.kirupa.com/u/v_gyku)
#### Post date: [September 11, 2006, 10:18am UTC](https://forum.kirupa.com/t/as3-play-sound-on-click-of-a-button/200333/1 "2006-09-11T10:18:41Z")

</div>

I want to play a sound on click of a button. I can do this in AS 2.0

//Action Script 2.0

```auto
 
snd=new Sound();
snd.attachSound("try");
snd.start();

```

//Action Script 3.0

```auto
 
var snd:Sound = new Sound();
//what will come here, as .attachSound() is not there in AS 3.0
snd.play();

```

Thanks…
