I have two frames.
In the first frame you can click a button to go to the next frame. In the first frame I want to add menu1
to the stage just once. If we go to the next frame and then back to the first frame, the menu1
should not be created again since it is already on the stage.
My problem is, when I go back from frame 2 to frame 1, it keeps adding menu1
copies to the stage.
Here is my current code:
stop();
import flash.display.Loader;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.display.Stage;
var menu1:Loader = new Loader();
var request1:URLRequest = new URLRequest ("MENU1.swf");
menu1.load(request1);
if (stage.contains(menu1)){
}
else
{
addChild(menu1);
}