Tag Archives: arraycollection

Sort an ArrayCollection

If you have an ArrayCollection and need to sort it, heres a quick example: import mx.collections.ISort; import mx.collections.ISortField; var sort:ISort = new Sort(); var sortfieldNome:ISortField = new SortField(“name”,true); // “name” is a field on the arraycollection var sortfieldEmail:ISortField = new SortField(“email”,true); // “email” is another field on the arraycollection sort.fields = [sortfieldNome, sortfieldEmail]; myArrayCollection.sort =… Read More »

Copy ArrayCollection – not as a reference

On my day job, i needed to copy an ArrayCollection to a different var so i could manipulate it without affecting the original. Went with this: arraycollection2 = arraycollection1; With this method, all i did to arraycollection2 was also happening to arraycollection1. to copy arrayCollection1 to arrayCollection2 without making it a reference: arrayCollection2 = ObjectUtil.copy(arrayCollection1)… Read More »