// AllBool function to detect equality between
// X given Bools and a preset constant (Bool)
// By Jesse Stratford, jesse@actionscript.org
function allBool (name, count, expected) {
for (var k = 1; k<=count; k++) {
if (this[name+k] != expected) {
return false;
}
}
return true;
}
foo1 = true;
foo2 = true;
foo3 = true;
// All true vars, check for truth, returns true
trace (allBool("foo", 3, true));
bar1 = true;
bar2 = true;
bar3 = false;
// One false var, check for truth, returns false
trace (allBool("bar", 3, true));
// Attempt to check 4 vars when only 3 exist
// even though all three are true, return false
trace (allBool("foo", 4, true));