# Boolean Variable to control MovieClip

**URL:** <https://forum.kirupa.com/t/boolean-variable-to-control-movieclip/254621>\
**Category:** flash\
**Created:** [March 13, 2008, 4:50pm UTC](https://forum.kirupa.com/t/boolean-variable-to-control-movieclip/254621 "2008-03-13T16:50:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gurdy](https://avatars.discourse-cdn.com/v4/letter/g/9d8465/32.png) [@gurdy](https://forum.kirupa.com/u/gurdy)\
**Post date:** [March 13, 2008, 4:50pm UTC](https://forum.kirupa.com/t/boolean-variable-to-control-movieclip/254621/1 "2008-03-13T16:50:40Z")

</div>

Hi this is my first post so it would be great if someone could help.

i am trying to assign boolean variables to my script that i have made, basically i have never done it before so i have no idea how to add them to my script. i am controlling movieclips using alpha levels so when a key is pressed it makes a mc =100 and when the key is released it takes the alpha back down to 0. My mc work fine along with the keypresses, its just i need more control over what has already come up.

I want to use the boolean variables so that they control the mc and stop them from playing after a certain amount of times the key is pressed.  
here is some of my script:

stop();  
this.onEnterFrame = function() {  
if (Key.isDown(65)) {  
trace(“It’s an A”);  
girl\_mc.\_alpha = 100;  
} else {  
girl\_mc.\_alpha = 0;  
}  
if ((Key.isDown(85)) && (Key.isDown(65))) {  
trace(“It’s a U and an A”);  
carnival2\_mc.\_alpha = 100;  
} else {  
// if it’s not down  
carnival2\_mc.\_alpha = 0;  
}  
if ((Key.isDown(85)) && (Key.isDown(65)) && (Key.isDown(84))) {  
trace(“It’s a U, T and an A”);  
tree\_mc.\_alpha=50, carnival2\_mc.\_alpha=0, yo\_mc.\_alpha=50;  
} else {  
// if it’s not down  
tree\_mc.\_alpha=0, yo\_mc.\_alpha=0;  
}  
if ((Key.isDown(85)) && (Key.isDown(65)) && (Key.isDown(84)) && (Key.isDown(79))) {  
trace(“It’s a U, O, T and an A”);  
handy\_mc.\_alpha=50, carnival2\_mc.\_alpha=0, tree\_mc.\_alpha=0, yo\_mc.\_alpha=0;  
} else {  
// if it’s not down  
handy\_mc.\_alpha = 0;  
}  
};
