Having some trouble with a menu I wrote a little while ago. The buttons change colors when selected, though I’ve no idea how to change the frame to frame 2 when I click the button. this.gotoAndStop(2) doesn’t work because the code is in the object class for the menu Movieclip. What should I have use instead of ‘this’ to make the game jump to frame 2? The code from my menu object’s actionscript class is below:
package {
import flash.display.;
import flash.events.;
import flash.text.*;
import flash.geom.ColorTransform;
import flash.ui.Mouse;
public class MenuHandler extends MovieClip {
//Variables
private var button_start:Object;
private var button_select:Object;
private var button_options:Object;
public function MenuHandler() {
button_start = new Object();
button_start.mc = this.New_Game.base;
button_select = new Object();
button_select.mc = this.Level_Select.base;
button_options = new Object();
button_options.mc = this.Options.base;
this.addEventListener(Event.ENTER_FRAME, onButton);
this.New_Game.addEventListener(MouseEven t.CLICK, newGame);
//this.Level_Select.addEventListener(Mou seEvent.CLICK, levelSelect);
//this.Options.addEventListener(MouseEve nt.CLICK, options);
}
//Rolling over button
public function onButton(event:Event) {
var ct:ColorTransform = new ColorTransform();
var rct:ColorTransform = new ColorTransform();
ct.color = 0xFFCC33;
rct.color = 0x999999;
if(this.mouseX >= 360 && this.mouseX <=510 && this.mouseY >= 150 && this.mouseY <= 180) {
button_start.mc.transform.colorTransform = ct;
}else {
button_start.mc.transform.colorTransform = rct;
}
if(this.mouseX >= 360 && this.mouseX <= 510 && this.mouseY >= 180 && this.mouseY <= 210) {
button_select.mc.transform.colorTransfor m = ct;
}else {
button_select.mc.transform.colorTransfor m = rct;
}
if(this.mouseX >= 360 && this.mouseX <= 510 && this.mouseY >= 210 && this.mouseY <= 240) {
button_options.mc.transform.colorTransfo rm = ct;
}else {
button_options.mc.transform.colorTransfo rm = rct;
}
}
public function newGame(event:MouseEvent) {
this.gotoAndStop(2); //This is the part of the code I’m referring to above.
//What should I replace ‘this’ with so that the game with go to frame 2?
}
}
}