# Button Event

**URL:** https://forum.kirupa.com/t/button-event/326181
**Category:** flash
**Created:** [November 28, 2011, 2:47pm UTC](https://forum.kirupa.com/t/button-event/326181 "2011-11-28T14:47:50Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![LilTad](https://avatars.discourse-cdn.com/v4/letter/l/f475e1/32.png) [@LilTad](https://forum.kirupa.com/u/LilTad)
#### Post date: [November 28, 2011, 2:47pm UTC](https://forum.kirupa.com/t/button-event/326181/1 "2011-11-28T14:47:50Z")

</div>

Hello, I have a state in which I have to create a bunch of custom text that can be clicked. This seemed pretty easy at first and I got it done but now I have to add an individual sound event to each one. Here’s what I was trying until I hit a wall:

```auto
     public function CreateButton(nPosX:Number, nPoxY:Number, sClip:Sound, sWord:String)
     {
            var tWord:TextField = new TextField();
            tWord.text = sWord;
            tWord.x = nPosX;
            tWord.y = nPosY;
            tWord.setTextFormat(Words);
            sStage.addChild(tWord);
            tWordaddEventListener(MouseEvent.MOUSE_DOWN, PlaySound);
            
      }

```

I was thinking that I could use something like this for each word’s sound event but I don’t know if you can somehow link individual sounds to each clickable object in AS3. Can it be done or would it be better to just scrap this?

```auto
public function PlaySound(me:MouseEvent)
        {
            trace("play sound");
        }

```
