I'm trying to put 2 functions on 1 event. By the click of the left mouse button you can make the visibility of a square go false and true. However it only works once. It disappears at the first click and it reappears at the second click. After that it no longer works. How do I make it so it constantly reads the code even after being used? Here's my code:
var poop = true;
stage.addEventListener(MouseEvent.CLICK, dissappearsquare)
function dissappearsquare(evt:MouseEvent):void
{
if(poop == true)
{
square2.visible = false;
poop = false;
}
stage.addEventListener(MouseEvent.CLICK, dissappearsquare1)
function dissappearsquare1(evt:MouseEvent):void
{
if(poop == false)
{
square2.visible = true;
poop = true;
}
}
}
}
I hope I supplied enough information , thank you for any input.