# Toggle Button Help

**URL:** <https://forum.kirupa.com/t/toggle-button-help/297833>\
**Category:** flash\
**Created:** [October 8, 2009, 11:15pm UTC](https://forum.kirupa.com/t/toggle-button-help/297833 "2009-10-08T23:15:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhalfbee](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@dhalfbee](https://forum.kirupa.com/u/dhalfbee)\
**Post date:** [October 8, 2009, 11:15pm UTC](https://forum.kirupa.com/t/toggle-button-help/297833/1 "2009-10-08T23:15:46Z")

</div>

I am trying to script buttons to open and close content windows; I have them currently scripted so you click on the button to close the content window again but I want them to close if you click the other button as well. Below is the script I am using for the two buttons, frame 2 plays the movie clip which expands the content window, frame 10 retracts the content window:

function toggleContent2(event:MouseEvent) {

if (togglescreen2.currentFrame == 1) {

togglescreen2.gotoAndPlay(2);

} else {

togglescreen2.gotoAndPlay(10);

}

}

toggle\_btn2.addEventListener(MouseEvent.CLICK, toggleContent2);

OTHER BUTTON:

function toggleContent(event:MouseEvent) {

if (togglescreen.currentFrame == 1) {

togglescreen.gotoAndPlay(2);

} else {

togglescreen.gotoAndPlay(10);

}

}

toggle\_btn.addEventListener(MouseEvent.CLICK, toggleContent);

Thank you in advance for any assistance!

E
