# gotoAndStop with button in class

**URL:** https://forum.kirupa.com/t/gotoandstop-with-button-in-class/320967
**Category:** flash
**Created:** [April 7, 2011, 12:36am UTC](https://forum.kirupa.com/t/gotoandstop-with-button-in-class/320967 "2011-04-07T00:36:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![eelbot](https://avatars.discourse-cdn.com/v4/letter/e/8baadc/32.png) [@eelbot](https://forum.kirupa.com/u/eelbot)
#### Post date: [April 7, 2011, 12:36am UTC](https://forum.kirupa.com/t/gotoandstop-with-button-in-class/320967/1 "2011-04-07T00:36:23Z")

</div>

Hello, I am trying to create a button class that will gotoAndStop at a specific frame, however I seem unable to…I was wondering if anyone has any suggestions on what to do here. My code is as follows:

package {  
import flash.events.MouseEvent;  
import flash.display.SimpleButton;  
import flash.display.FrameLabel;

```
public class PlayButton extends SimpleButton {

    public function PlayButton() {
        this.addEventListener(MouseEvent.MOUSE_DOWN, expand);
    }
    private function expand(event:MouseEvent):void{
        gotoAndStop(2);
    }

}

```

}

The error I get is error 1180:Call to a possible undefined method gotoAndStop.

Thanks!
