this is a part of my code:
private var sun:Sun;
private var aantalSun:int = 5;
private var counter:int;
for (counter = 0; counter < aantalSun; counter++)
{
sun = new Sun();
addChild(sun);
}
when the whole code is running, there is a button called 'menu' on the stage. when i click that button, i want to go back to my main menu, but there are still 5 sun on my stage. how can i remove the 5 sun (like, stop the loop?) when i click the menu button? i already tried removeChild(sun);, but then only one sun goes away.