Not to be harsh, but this sounds like something my first cs course in college would have had as an assignment or problem in a homework set.
This has nothing to do with flex. var A:Array = [15,15,35,35,35,35, 35,55,55,75,95,105,115,115,115]; var B:Array = new Array(); Var maxrun:Number=0; for each(var n:Number in A) { if(!B[n]) B[n]=1; else B[n]++; if(B[n]>maxrun) maxrun=B[n]; } From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of jmfillman Sent: Wednesday, January 23, 2008 2:26 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Array Item Counting I have an array with several dynamically populated numbers. The array is then sorted to group identical values together. Let's say my array contains the following:[15,15,35,35,35,35, 35,55,55,75,95,105,115,115,115] What I need to do is get a count of each number, and determine the highest frequency, in the above example, the number 35 is listed 4 times, so I would need to set a variable = 4. I've been playing around with a for loop. Since I have 168 potential matches (15, 35, 55, 75, 95, all the way to 2875) incrementing by 20, that's a bit excessive for a bunch of if statements. It seems like a nested for loop could do this, but I can't figure it out. Maybe there's an even better way I haven't considered. for (var rowCount:int=0;rowCount < arrayRows.length;rowCount++){ var my15:int; if (arrayRows[rowCount].row == 15){ my15 = my15+1; trace (my15); } }