button to add and remove a movieclip
I'm trying to make a button that will add and remove a movieclip. For some reason it wont remove the movieclip when it's clicked on and I can't seem to figure out what I did wrong. Below is the code I'm using. Even if I remove the else part from the function it wont remove the movieclip when the button is clicked on.
var instructions = new instructionsFirewall();
var instructionsOut:Boolean=false;
instructionButton.addEventListener(MouseEvent.CLICK, instructionsClick);
addChild(instructions);
instructions.x = 48;
instructions.y = 99;
function instructionsClick(MouseEvent):void {
if (instructionsOut=false){
removeChild(instructions)
instructionsOut=true
}
else{
addChild(instructions);
instructions.x = 48;
instructions.y = 99;
instructionsOut=false
}
}