# Toggling 1 movieclip at a time

**URL:** <https://forum.kirupa.com/t/toggling-1-movieclip-at-a-time/277316>\
**Category:** Uncategorized\
**Created:** [December 10, 2008, 7:08pm UTC](https://forum.kirupa.com/t/toggling-1-movieclip-at-a-time/277316 "2008-12-10T19:08:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmcinnis](https://avatars.discourse-cdn.com/v4/letter/b/c37758/32.png) [@bmcinnis](https://forum.kirupa.com/u/bmcinnis)\
**Post date:** [December 10, 2008, 7:08pm UTC](https://forum.kirupa.com/t/toggling-1-movieclip-at-a-time/277316/1 "2008-12-10T19:08:48Z")

</div>

**Hi ,**

I’m new to AS3 and kinda stuck. Basically, I have different buttons that toggle movieclips on/off. I have this concept working fine. However, I can’t seem to figure out how to toggle 1 at a time.

To expand, if I press a button, movieclips associated with it will be visible=true, and any other button with associated movieclips currently visible will be visible=false.

If anyone could shed some light, it would be appreciated.

**My 1st frame code looks like this:**

// start mc as invisible  
park1.visible=false;  
park2.visible=false;

// visiblility functions  
function eventResponse(event:MouseEvent):void  
{  
if(park1.visible){  
park1.visible = false  
}else{  
park1.visible = true  
}  
if(park2.visible){  
park2.visible = false  
}else{  
park2.visible = true  
}  
}  
// dot rollover functions  
function test(event:MouseEvent):void {  
park1info.gotoAndPlay(“play”) ;  
}  
function test2(event:MouseEvent):void {  
park2info.gotoAndPlay(“play”) ;  
}

// Event listeners  
button\_mc.addEventListener(MouseEvent.CLICK, eventResponse);  
park1.addEventListener(MouseEvent.ROLL\_OVER, test);  
park2.addEventListener(MouseEvent.ROLL\_OVER, test2);
