-
[MX04] Comparing values from array ... possible bug?
I'm trying to find the max value in an array and keep getting a value that isn't the max. Here's the function:
function maxValue(array) {
mxm = array[0];
for (i=0; i<array.length; i++) {
if (array[i]>mxm) {
mxm = array[i];
}
}
return mxm;
}
It's an array of about 15 values. The largest is 3984000, but the function returns 954000 as the max. In case it matters the array draws from an XML document. The only thing I can think of is that because 9>3 Flash sees the first integer and assumes that's the largest number, but it obviously isn't. Any ideas?
Thanks! Jared
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|