# gotoAndStop Revisited

**URL:** <https://forum.kirupa.com/t/gotoandstop-revisited/310479>\
**Category:** flash\
**Created:** [June 11, 2010, 12:44am UTC](https://forum.kirupa.com/t/gotoandstop-revisited/310479 "2010-06-11T00:44:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dyoung\_tm2d\_com](https://avatars.discourse-cdn.com/v4/letter/d/e47774/32.png) [@dyoung\_tm2d\_com](https://forum.kirupa.com/u/dyoung_tm2d_com)\
**Post date:** [June 11, 2010, 12:44am UTC](https://forum.kirupa.com/t/gotoandstop-revisited/310479/1 "2010-06-11T00:44:30Z")

</div>

Didn’t get any takers on the last question so I thought I would try again. I am getting a compiler error when I try to use a gotoAndStop function in a static method in one class that is being activated by a button in another class.

Line 33 1180: Call to a possibly undefined method gotoAndStop

Here is the code for the Main Script

package scripts  
{  
import flash.display.MovieClip;  
import flash.events._;  
import flash.utils._;

public class MainScript extends MovieClip  
{

public function MainScript()  
{  
gotoAndStop(“home”);

var advance:buttonMovie = new buttonMovie();  
advance.x = 10;  
advance.y = 10;  
advance.buttonMode = true;  
addChild(advance);

advance.addEventListener(MouseEvent.MOUSE\_DOWN, onAdvanceClicked);

}

function onAdvanceClicked(event:MouseEvent):void  
{  
gotoAndStop(“page2”);  
}

public static function onAnotherButtonClicked(event:MouseEvent):void  
{  
trace (“This button was clicked from the submovie”);  
gotoAndStop(“page3”);  
}  
}  
}

And here is the code from the SubScriptTool with the button function that calls the script.

package scripts  
{  
import flash.display.MovieClip;  
import flash.display.Sprite  
import flash.events.\*;

public class SubScriptTool extends MovieClip  
{

public function SubScriptTool()  
{  
var anotherbutton:buttonMovie = new buttonMovie();  
anotherbutton.x = 43;  
anotherbutton.y = 243  
anotherbutton.buttonMode = true;  
addChild(anotherbutton);

anotherbutton.addEventListener(MouseEvent.MOUSE\_DOWN, MainScript.onAnotherButtonClicked);  
}

}  
}

any help would certainly be appreciated.
