Hi Kirupa members,
Long time reader, first time posting so hope my etiquette is in order.
I have a program I am building that at the moment has two classes (more to add in later), a main class and a visual training class. The main class contains the main menu and the visual training is one of the links.
I introduce the visual training class from the main class like so:
/*---------------------------------------------------------
VISUAL TRAINING ELEMENT
---------------------------------------------------------*/
var training:VisualTraining; //declare the viusal training object
public function Main()
{
/*-----------------------------------------------------
DEFINE ITEMS
-----------------------------------------------------*/
training = new VisualTraining();
}
And this is the call that starts the functions within the Visual Training Class
function callVisualTrainingClass():void{
addChild(training);
training.startVisualTraining();
}
This works fine in that the Visual Training class is called and the program steps through with no errors. The problem I have is ending the invlovement of the visual training class and returning to the main class.
//navigational buttons for visual training
right_btn = new RightButton;
right_btn.x = 510;
right_btn.y = 630;
right_btn.buttonMode = true;
addChild(right_btn);
/* ----------------------------------------------------------
RELOADS THE MAIN MENU SO THAT THE USER CAN RESTART
------------------------------------------------------------*/
function backToMain(e:MouseEvent):void
{
returnHome_btn.removeEventListener(MouseEvent.CLICK, backToMain);
removeChild(returnHome_btn);
//removeChild(training);
//mainMenu();
}
I have created a home button with a call to a backToMain function, how do I get this function to remove the visual training element from the stage???