[thelist] Programming - Finding Largest Value

bread_man bread_man at hotmail.com
Wed Mar 20 07:50:01 CST 2002


This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
Hi Programming Gurus,

I am trying to find out which variable from a set of 8 contains the highest value, using actionscripting in my flash movie.

The variables are named var1 through var8. I wanted to figure out which variable is the largest and assign that to a new variable and so I threw in this code:

_level0.biggest = _level0.var1

for (i=1; i<9; i++) {
    if (_level0["var" + i] > _level0.biggest) {
    _level0.biggest = _level0["var" + i];
    }
}

The script isn't returning the correct value for the variable "biggest."  I'm sure the same logic applies to any language, could someone tell me why this function doesn't work?  Or can anyone suggest another means to find the largest value of a group?

Thanks much!
bread_man




More information about the thelist mailing list