gotoAndPlay from a class

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: