What about something like this:

var results:Array = [ "a", "b", "c", "d", "e", "f", "g", "h", "i",
"j", "k", "l", "m", "n", "o", "p" ];

function getResult( value1:Boolean, value2:Boolean, value3:Boolean,
value4:Boolean ):Number
{
        var resultIndex:Number = 0;
        
        if( value1 ) resultIndex |= 8;
        if( value2 ) resultIndex |= 4;
        if( value3 ) resultIndex |= 2;
        if( value4 ) resultIndex |= 1;
        
        return results[ resultIndex ];
}

trace( getResult( true, true, false, true) );

/*
Results Table

value1  value2  value3  value4  Results
0                       0                       0                       0       
                a
0                       0                       0                       1       
                b
0                       0                       1                       0       
                c
0                       0                       1                       1       
                d
0                       1                       0                       0       
                e
0                       1                       0                       1       
                f
0                       1                       1                       0       
                g
0                       1                       1                       1       
                h
1                       0                       0                       0       
                i
1                       0                       0                       1       
                j
1                       0                       1                       0       
                k
1                       0                       1                       1       
                l
1                       1                       0                       0       
                m
1                       1                       0                       1       
                n
1                       1                       1                       0       
                o
1                       1                       1                       1       
                p
*/

On 1/25/06, eric dolecki <[EMAIL PROTECTED]> wrote:
> I have 4 variables I need to check the states of routinely... and
> combinations thereof.

--
Daniel Cascais
Tel: +56 (0)2  4589495
Cel: +56 (0)9  9417355
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to