I am using actionscript 3 to make a point and click game. On frame 1 there are two buttons, button 1 and 2. On frame 3 there are two buttons, button A and B.
I want it
If you try to remove something that is not in the display list yet Flash will thrown an error. I guess the best solution here is setting up a timeline variable to keep track of which button you have pressed. Something like this:
on frame 1
var b1:Boolean = false;
var b2:Boolean = false;
button1.addEventListener(MouseEvent.MOUSE_DOWN, checkButton);
button2.addEventListener(MouseEvent.MOUSE_DOWN, checkButton);
function checkButton(e:MouseEvent):void
{
if(e.target.name == button1) b1 = true;
else b2 = true;
gotoAndPlay(3);
}
on frame 3
myButtomA.visible = false;
myButtomB.visible = false;
if (b1) myButtomA.visible = true;
if (b2) myButtomB.visible = true;