# Help with boolean that tests combination of values

**URL:** <https://forum.kirupa.com/t/help-with-boolean-that-tests-combination-of-values/325930>\
**Category:** Uncategorized\
**Created:** [November 12, 2011, 4:12am UTC](https://forum.kirupa.com/t/help-with-boolean-that-tests-combination-of-values/325930 "2011-11-12T04:12:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bananabuns](https://avatars.discourse-cdn.com/v4/letter/b/91b2a8/32.png) [@bananabuns](https://forum.kirupa.com/u/bananabuns)\
**Post date:** [November 12, 2011, 4:12am UTC](https://forum.kirupa.com/t/help-with-boolean-that-tests-combination-of-values/325930/1 "2011-11-12T04:12:02Z")

</div>

Any help with the code below would be greatly appreciated! I’m really stuck. ![](http://forum.kirupa.com/uploads/kirupa/525/d5236136df0858f4.gif)

The objective is when user clicks on any combination of 2 buttons you would then gotoAndPlay a new page based onthe\*\* two specific buttons\*\* you have selected? Ideally user would be able to intermix the button combinations.\*

I’ve attached a simple diagram that visually explains objective of actionscript.\*  
[![](http://www.kirupa.com/forum/attachment.php?attachmentid=54307&stc=1&thumb=1&d=1321071076)](http://www.kirupa.com/forum/attachment.php?attachmentid=54307&d=1321071076)  
Code below only works for two specific buttons, but doesn’t allow to intermix button clicks.

import flash.events.MouseEvent;

var blueClicked:Boolean = false;  
var yellowClicked:Boolean = false;  
var redClicked:Boolean = false;  
var greenClicked:Boolean = false;

blue\_btn.addEventListener(MouseEvent.CLICK, blue\_onClick); yellow\_btn.addEventListener(MouseEvent.CLICK, yellow\_onClick); red\_btn.addEventListener(MouseEvent.CLICK, red\_onClick); green\_btn.addEventListener(MouseEvent.CLICK, green\_onClick);

function red\_onClick(event:MouseEvent):void {  
redClicked = true;  
if(redClicked && greenClicked) {  
proceedone(); }  
}

function green\_onClick(event:MouseEvent):void {  
greenClicked = true;  
if(redClicked && greenClicked) {  
proceedone(); }  
}

function proceedone():void {

trace(“both red and green buttons have been clicked”);  
gotoAndStop (“about”);

}
