You could use a Boolean (true/false) rather than a counter for keeping track/assigning the visibility. You could use the counter simply to determine whether you are just starting the file or not. When you click that button you set the mc.visible property and then assign the boolean the visible property of the mc.
var mcVisible:Boolean; // these two variables need to extend the length off the timeline
var count:int;
if(count == 0) { // you've just started so set things up
mcVisible = mc.visible;
count += 1;
} else {
mc.visible = mcVisible; // you're returning so set the visibility of the mc
}
function show_hide_MC(evt:MouseEvent):void {
mc.visible = !mc.visible; // switch the visibility
mcVisible = mc.visible; // remember how you left it
}
You could just use the count as well, incrementing it everytime you click the button and using the modulus to determine if it has been clicked an even number of times versus an odd number of times and then have a conditional that tests that and assigns the visibility... something like...
var count:int; // will start off with a default of 0
// needs to extend the length of the timeline
if(count%2 == 0) { // it's an even value
mc.visible = true;
} else { // it's an odd value
mc.visible = false;
}
function show_hide_MC(evt:MouseEvent):void {
mc.visible = !mc.visible; // switch the visibility
count += 1;
}