# Help with IF STATEMENTS

**URL:** https://forum.kirupa.com/t/help-with-if-statements/302785
**Category:** flash
**Created:** [January 7, 2010, 2:00pm UTC](https://forum.kirupa.com/t/help-with-if-statements/302785 "2010-01-07T14:00:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![BUroKHUli](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/burokhuli/32/190_2.png) [@BUroKHUli](https://forum.kirupa.com/u/BUroKHUli)
#### Post date: [January 7, 2010, 2:00pm UTC](https://forum.kirupa.com/t/help-with-if-statements/302785/1 "2010-01-07T14:00:59Z")

</div>

hi, I made a condition that only when you press a certain key + click, a movie clip will play. it worked, but everytime I click on the button, the clip naturally goes to that frame where it says gotoAndPlay, so I decided to add a variable “\_root.var\_controlpanel = false;”

(goto [www.huachingfoundation.com](http://www.huachingfoundation.com) and click on the COYPRIGHT symbol while pressing “z” and “x”)

now this is where I get things messed up. I can make the variable work, but without the keypress combination. I make the keypress combination but without the variable. my question is how do I combine the two to work together? thank you 🙂

my algorithm should go like this:

if buttons pressed {  
and if variable is false {  
showpanel;  
set variable to true;  
else do nothing  
}  
}

* * *

showpanel\_btn.onRelease = function() {  
if (Key.isDown(88) & Key.isDown(90)) {  
controlpanel\_mc.gotoAndPlay(“showpanel”);  
}  
};

* * *

showpanel\_btn.onRelease = function() {  
if (\_root.var\_controlpanel == false) {  
controlpanel\_mc.gotoAndPlay(“showpanel”);  
}  
\_root.var\_controlpanel = true;  
};
