# Controlling 4 variables result

**URL:** <https://forum.kirupa.com/t/controlling-4-variables-result/274309>\
**Category:** Uncategorized\
**Created:** [October 28, 2008, 10:06am UTC](https://forum.kirupa.com/t/controlling-4-variables-result/274309 "2008-10-28T10:06:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcogiannini](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@marcogiannini](https://forum.kirupa.com/u/marcogiannini)\
**Post date:** [October 28, 2008, 10:06am UTC](https://forum.kirupa.com/t/controlling-4-variables-result/274309/1 "2008-10-28T10:06:33Z")

</div>

Hi all,  
in an adventure game I’m coding during these days, I have a movieclip containing 4 rotating handles. When the four handles linked with a variable returns a certain value, a door opens.  
I’ve tried to use && operator, in this way:

this.onEnterFrame = function() {  
if ((\_root.gira1 == 1) && (\_root.gira2\>0) && (\_root.gira3\>0) && (\_root.gira4\>0)) {  
gotoAndPlay(“action”);  
delete this[“onEnterFrame”];  
}  
}

this doesn’t function because && operator just compare two expressions, and no more than two (that is the function will function if I limit it to control just (\_root.gira1\>0) && (\_root.gira2\>0))

How can I replace this simple code with a 4-variables controlling one? A for cycle will be the solution?

thanking you in advance
