# Make a two-state Button

**URL:** https://forum.kirupa.com/t/make-a-two-state-button/328694
**Category:** flash
**Created:** [June 7, 2012, 10:51am UTC](https://forum.kirupa.com/t/make-a-two-state-button/328694 "2012-06-07T10:51:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![MFRS](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@MFRS](https://forum.kirupa.com/u/MFRS)
#### Post date: [June 7, 2012, 10:51am UTC](https://forum.kirupa.com/t/make-a-two-state-button/328694/1 "2012-06-07T10:51:55Z")

</div>

I am trying to make a check button where when i click it shows an arrow inside the box, and when i click again i get the state i had in the first place, so i used this:

```auto
var VistoContainer:MovieClip;

var counterVisto:int;

**certoErrado(1);
VistoContainer.addEventListener(MouseEvent.CLICK, checkA);

function checkA(e:MouseEvent) :void{
    certoErrado(2);
    if (counterVisto ==2){
        certoErrado(1);
        counterVisto-=2;
    }**
    
}

function certoErrado(numeroA:int) :void{
    if (VistoContainer != null) {
        removeChild(VistoContainer);
    }
    if (numeroA ==1) {
        VistoContainer = new certoA();
    }else if (numeroA ==2) {
        VistoContainer = new foraA();
        counterVisto++;
        trace(counterVisto);
    }
    VistoContainer.x = 627,15;
    VistoContainer.y = 344,10;
    addChild(VistoContainer);

}

```

I used a counter to check when the button it’s clicked the second time, and then go back to the first state, but it doesn’t work. Anyone knows how to do this?
