Actionscript 3; how to make a toggle button?
<p>Currently making a button that will toggle the visibility of a movie clip on and off. Here is my code;</p>

<pre><code>infoButton.addEventListener(MouseEvent.CLICK, howToPlay);


var boxUp:Boolean = false;

function howToPlay(event:MouseEvent):void 
{
    if(boxUp == false)
    {
        infoBox.visible = true;
        boxUp = true;
    }
    if(boxUp == true){
        infoBox.visible = false;
        boxUp = false;
    }


}
</code></pre>

<p>However when clicking the button nothing happens. I'm assuming this is because it's a self contradicting function, however I don't know any other way to store if the movie clip is visible or not.</p>

<p>Can anyone help?</p>