Hello,
I have recently started learning actionscript 3, and I think this is just some concept I am not understanding.
I found a class for a menu that I am using, basically I want to attach a Movie Clip to the stage when a menu button is hit, but I am stuck on how to do this. Basically I have this in my main timeline:
import menuexample.BasicMenu;
import movieClipTest.movieClipTest;
var myMenu:BasicMenu = new BasicMenu();
myMenu.init();
myMenu.x = 50;
myMenu.y = 100;
addChild(myMenu);
var myClip:movieClipTest = new movieClipTest();
myClip.init();
// now how do I add it to the stage when a button is hit in the menu?
I have this in my BasicMenu class:
private function displayMessage(event:MouseEvent):void {
// Output the name of the clicked button.
trace(event.currentTarget.name);
}
Which traces the text (which is set to the button name) to the output window.
Can I do any kind of call back function? I know AS3 is trying to get away from this.
Thanks in advandce