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:
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?