# 3-way If/Else toggle

**URL:** https://forum.kirupa.com/t/3-way-if-else-toggle/255195
**Category:** flash
**Created:** [March 19, 2008, 10:48pm UTC](https://forum.kirupa.com/t/3-way-if-else-toggle/255195 "2008-03-19T22:48:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rynobot](https://avatars.discourse-cdn.com/v4/letter/r/bbce88/32.png) [@rynobot](https://forum.kirupa.com/u/rynobot)
#### Post date: [March 19, 2008, 10:48pm UTC](https://forum.kirupa.com/t/3-way-if-else-toggle/255195/1 "2008-03-19T22:48:30Z")

</div>

I have several buttons which make visible different sub navigations - however some of the sub navigations are relative to more than one section.  
The button code below works for the individual buttons, but I need it to say something like this:

- if Btn1 is selected myMC is visible.
- if Btn2 is selected myMC is visible.
- if both buttons are selected and the user deselects one of the buttons myMC is visible.
- if both Btn1 and Btn2 are deselected myMC is not visible.

```auto
Btn1.onRelease = function() {
if (myMC._visible == false) {
		myMC._visible = true;
	} else {
		myMC._visible = false;
	}
Btn2.onRelease = function() {
if (myMC._visible == false) {
		myMC._visible = true;
	} else {
		myMC._visible = false;
	}

```

does that make sense? thanks in advance…
