Re: [Flashcoders] Sorting objects within an Array ...

2006-04-14 Thread Erik Porroa V.
I forget you can use "Array.NUMERIC" when you want to sort an array :D So you must to put: aMovieClipsSorted.sort(Array.NUMERIC); Erik Porroa V. escribió: Ey Stephen, you can do something like this: //Create a function that return the sorted numbers function sortByNumber(a, b) { return (a > b)

Re: [Flashcoders] Sorting objects within an Array ...

2006-04-14 Thread Erik Porroa V.
Ey Stephen, you can do something like this: //Create a function that return the sorted numbers function sortByNumber(a, b) { return (a > b); } //I guess this array will be generated dinamically var aMovieClips:Array = new Array("mcClip0", "mcClip1", "mcClip2"); //A new array where will go the sc

Re: [Flashcoders] Sorting objects within an Array ...

2006-04-14 Thread Michael Bedar
You need to supply a custom sort function, like // function mySort(a,b){ if (a._xscaleb._xscale){ return 1 }else{ return 0 } } // then sort with it... myArray._xscale.sort(mySort) Or you could try a .sortOn() with _xscale, but i'm not sure offhand if that works... On Apr 14, 2006, at 11:48

[Flashcoders] Sorting objects within an Array ...

2006-04-14 Thread Stephen Ford
Hello All. Here is what I have and what I'm trying to do: I have an array that contains 3 objects (which are all movie clips), like so: var myArray:Array = ["mcClip1", "mcClip2", "mcClip3"]; I want to sort this array according to the _xscale of these clips. Does anyone know how I can do thi