Hi Chris,

You have a few options. To simply reverse your xml you can use code
like this:

var x:XML = new XML("<newXML/>");
for each(var node:XML in myXML.children())
{
        x.prependChild(node);
}

To convert the xml into an array which you can then reverse():

var coll:XMLListCollection = new XMLListCollection(myXML.children());
var arr:Array = coll.toArray();
arr.reverse();

Converting strings to dates should also be pretty straightforward
using DateFormatter.

HTH,
Ben


--- In [email protected], "Chris MacGregor" <[EMAIL PROTECTED]> wrote:
>
> Anyone,
> 
> I'm still having trouble getting my head around the way FLEX handles
> XML objects. Here's my issue, I'm consuming an XML document with a
> years worth of historical stock prices for a HLOCChart. The data comes
> into the FLEX in reverse chronological order with the dates in the
> format 'month/day/year' (e.g. '12/29/2006' or '1/3/2006'). I've tried
> the sort functions Simeon pointed me to, but they're not applicable to
> the date being formatted this way (because in this format November
> (11) and December (12) are between January (1) and February(2) ).
> 
> What I need to do is essentially 'flip' the order of the nodes so my
> chart can display with the oldest date on the left and the most recent
> on the right. I can't seem to apply a 'reverse()' method to the XML
> because it's not an Array and I can't figure out how to make the dates
> 'real' dates. The Flex documentation is as obscure on this matter too.
> I would think that this would be an easy solution, but I can't seem to
> find it.
> 
> Frustration is setting in. Any thoughts on techniques I should try?
> 
> Chris
>


Reply via email to