# gotoAndPlay from a class

**URL:** <https://forum.kirupa.com/t/gotoandplay-from-a-class/308154>\
**Category:** flash\
**Created:** [April 17, 2010, 7:31pm UTC](https://forum.kirupa.com/t/gotoandplay-from-a-class/308154 "2010-04-17T19:31:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashrocket](https://avatars.discourse-cdn.com/v4/letter/f/3ab097/32.png) [@flashrocket](https://forum.kirupa.com/u/flashrocket)\
**Post date:** [April 17, 2010, 7:31pm UTC](https://forum.kirupa.com/t/gotoandplay-from-a-class/308154/1 "2010-04-17T19:31:35Z")

</div>

Hi,

I’m rather new to Flash and would be grateful for any help here, or a push in the right direction.

I’m trying to write a class file that listens for a mouse click on a tab menu then opens the corresponding page by jumping to a certain frame using gotoAndPlay().

When I run it Flash gives me the following 2 warnings:

[COLOR=Red]1180: Call to a possibly undefined method gotoAndPlay.

Warning: 1060: Migration issue: The method gotoAndPlay is no longer supported. For more information, see MovieClip.gotoAndPlay()…[/COLOR]

Here’s my class file:

* * *

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

```
public class MenuAction extends SimpleButton
{       
    public function MenuAction()
    {
        addEventListener(MouseEvent.CLICK, menuChange);
    }
   
    private static var _previousTab:String;
   
    public function menuChange(event:MouseEvent):void
    {
        if(event.target.name != _previousTab)
        {
            _previousTab = event.target.name;
           [COLOR=Red]gotoAndPlay(2);[/COLOR]
           trace("New tab");
        }
       
        else
        {
            trace("Same tab");
        }
    }
}

```

}

* * *

I’m pretty sure it’s something to do with my class extending SimpleButton but then trying to use gotoAndPlay which is a MovieClip action. Do I have to make a separate MovieClip class and somehow link it to this? Or can I add some more code to this to get it to work?

Any help greatly appreciated :puzzled:
