Well, lets say you have 4 objects that have selected states & fired no
events on their own.

So there are many different possible combinations for the combined states of
those 4 objects. Each possible combination triggers an entirely seperate
action. Thats a lot of actions to account for.

So its all about detecting the unique combinations, and acting upon them.
Perhaps there really is no truly elegant way of doing this...


On 1/25/06, Merrill, Jason <[EMAIL PROTECTED]> wrote:
>
> Sounds like you're trying to do something like this, but even still your
> approach seems overly complex.  Maybe a more detailed explaination of
> what you're trying to do and what "combinations" are would help.
> Meanwhile, if I understand you, would something like this work?
>
> a = false
> b = false
> c = true
> d = true
> e = true
> f = false
> g = true
> h = false
> i = false
> //etc.
>
> myArray = [2,3,6,12,34,54,345,45,76,34]
> vars = ["a","b","c","d","e","f","g","h","i","j"]
> counter = 0;
> counter_arr = [];
>
> function checkVars(){
>         for(i=0; i<myArray.length; i++){
>                 if(this[vars[i]]){
>                         counter_arr.push(counter+=myArray[i])
>                         trace(vars[i]+" in vars array is true.");
>                         trace("counter is at: "+counter);
>                 }
>
>         }
> }
>
> checkVars();
>
>
> Jason Merrill   |   E-Learning Solutions   |  icfconsulting.com
>
>
>
>
>
>
>
>
>
>
> >>-----Original Message-----
> >>From: [EMAIL PROTECTED] [mailto:flashcoders-
> >>[EMAIL PROTECTED] On Behalf Of eric dolecki
> >>Sent: Wednesday, January 25, 2006 1:03 PM
> >>To: Flashcoders mailing list
> >>Subject: [Flashcoders] checking combinations
> >>
> >>I have 4 variables I need to check the states of routinely... and
> >>combinations thereof.
> >>
> >>I am assuming that if I have a counter, and interogate and += them
> values, I
> >>can then check the value of the counter to determine the combinations.
> >>
> >>psudeo-code:
> >>
> >>var counter:Number = 0;
> >>if ( a ){ counter += 2; }
> >>if ( b ){ counter += 3; }
> >>if ( c ){ counter += 6; }
> >>if ( d ){ counter += 12;}
> >>
> >>if ( counter == 2 ){
> >>     // only a was true
> >>} else if ( counter == 3 ){
> >>     // only b was true
> >>}  ...
> >>
> >>Which is fine, but thats gonna be one honkin' if else statement to
> catch all
> >>the combinations.
> >>
> >>Is there a better way of doing this that will catch all the possible
> >>combinations in an elegant way?
> >>
> >>- edolecki
> >>_______________________________________________
> >>Flashcoders mailing list
> >>Flashcoders@chattyfig.figleaf.com
> >>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> NOTICE:
> This message is for the designated recipient only and may contain
> privileged or confidential information. If you have received it in error,
> please notify the sender immediately and delete the original. Any other use
> of this e-mail by you is prohibited.
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to