# Button code from AS2 to AS3

**URL:** <https://forum.kirupa.com/t/button-code-from-as2-to-as3/279780>\
**Category:** flash\
**Created:** [January 19, 2009, 9:49am UTC](https://forum.kirupa.com/t/button-code-from-as2-to-as3/279780 "2009-01-19T09:49:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jo\_hamm](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jo\_hamm](https://forum.kirupa.com/u/jo_hamm)\
**Post date:** [January 19, 2009, 9:49am UTC](https://forum.kirupa.com/t/button-code-from-as2-to-as3/279780/1 "2009-01-19T09:49:21Z")

</div>

Hi

I am trying to create buttons that either gotoAndPlay(2); or gotoAndPlay(“Scene2”, 2); - I have done this perfectly well in AS2 but I am having trouble doing this in AS3.

This is the code I have so far but it doesn’t seem to do anything (tae is the instance name of my movie clip):

```auto
function buttonClicked(e:MouseEvent) {
e.currentTarget.gotoAndPlay(2);
}

tae.addEventListener(MouseEvent.CLICK, buttonClicked); 

```

It didn’t even work when I tried a trace:

```auto
function buttonClicked(e:MouseEvent) {
trace("button has been clicked"); 
}

tae.addEventListener(MouseEvent.CLICK, buttonClicked); 

```

I would really appreciate some help on this as I have been attempting it all weekend and nothing works.
