I'm a complete noob to flash and know I'm just missing something obvious here.
I have designed my screens as a movieclip and have buttons in each of the movieclips which link the menu screens together .. everything worked fine using the timeline and code snippets.
Now, I'm trying to do it in code, I'm having some problems:
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.MouseEvent;
public class Main extends MovieClip {
public function Main() {
// define variable main as the movieclip main
var main = new Main_menu();
var instructions = new instructions();
//add the movieclip to the stage
addChild(main);
// Tell the button to run function on_play.....
Instructions_btn.addEventListener(MouseEvent.CLICK, on_play_button_clicked);
}
// what the button does
public function on_play_button_clicked(event:MouseEvent) {
addChild(instructions);
}
}
}
I can get the movie clip Main to display and since ive added the buttons in the movieclip within flash they display fine and the cursor changes to a finger click icon :-)
What i cant seem to work out is how to get the button with class name: instructions_btn to add the screen : instructions when I click it.
Dead easy probably but I'm pulling my hair out!