I think as the sort happens, the child indexes will change.

 

I'd wrap the collection so that it iterates in reverse order.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Amy
Sent: Friday, August 08, 2008 7:06 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Sorting XMLListCollection by childIndex()

 

Hi, all;

I'm using an XMLLisCollection as the dataprovider for a bar chart. For 
some reason a bar chart draws the bars from bottom to top, rather than 
from top to bottom. This puts my data upside down, and the order is 
important in this application. I'd rather not change the data itself, 
so I need to sort the XMLListCollection. All the information I have on 
sorting shows using sortField. I need to sort on childIndex(), which 
is a method in e4x. Has anyone successfully sorted an 
XMLListCollection by childIndex?

This is what I've tried, and it seems to just sort randomly

var reverseSort:Sort= new Sort();
reverseSort.fields = [new SortField
('childIndex()', true, true)];
_data.sort=reverseSort;
_data.refresh()

}

 

Reply via email to