[FMX] Sorting X values of movie clips

Hi All,

I’ve got five movie clips (called horse1 through horse5) and I want to sort them to find out which has the highest x value. I thought putting them into an array and sorting that would be the best idea but I can’t seem to get even the array to work.

This is the code I have so far;

for (n=1; n<6; n++) {
var hr = “horse”+[n];
myArray=[[“horse”+[n], _level0.hr._x]];
trace (_level0.horse1._x);
trace (myArray);
}

which returns;

487.85
horse1,
487.85
horse2,
487.85
horse3,
487.85
horse4,
487.85
horse5,

I used the ‘hr’ variable because myArray reported an error if I tried
myArray=[[“horse”+[n], _level0.“horse”[n]._x]];

As you can see I do get an x value when I use
trace (_level0.horse1._x);

But I don’t get one if I use
trace (_level0.horse+[n]._x);

Hope this makes some sort of sense. I’m pretty new to this so any help is appreciated.

I’m running Flash MX on a PC.

Thanks,

Roughy