Ive been trying to sort an xml array based on a date , and i cant get it to work ive tried a few things at this point
/////////////////////////////////////////////////////////////////////////
function order(a, b):Number {
trace(a.childNodes.length)
var name1:Number = a;
var name2:Number = b;
trace(name1+", "+name2);
if (name1<name2) {
return -1;
} else if (name1>name2) {
return 1;
} else {
return 0;
}
}
///////////////////////////////////////////////////////////////////////////
El.onLoad = function(success:Boolean) {
var childs:XMLNode = this.firstChild;
var childTotal:Number = childs.childNodes.length;
var sh:Array = this.firstChild.childNodes;
_root.sh = sh;
dropframe = [];
for (i=0; i<sh.length; i++) {
dropframe.push(childs.childNodes*.childNodes[8].firstChild);
}
dropframe.sort();
_global.shh = childTotal;
for (i=0; i<sh.length; i++) {
sh.sort(dropframe);
trace(dropframe*);
var s:Array = sh*.childNodes;
ids = sh*.firstChild;
and the xml
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<newshows>
<showd>
<id>62</id>
<preview1>Apr 18, 2007 21:30</preview1>
<preview2>All s Place</preview2>
<preview3>West Hollywood, CA</preview3>
<detail1>Apr 18th 2007 @ 8:00pm</detail1>
<WEB>http://thegypsylounge.com/</WEB>
<detail2>Bob's Place</detail2>
<detail3>9081 Santa Monica Blvd %3Cbr%3EWest Hollywood,Ca.90069 %3Cbr%3E(714) 555-2222%3Cbr%3E%3Cbr%3E %3Ca%20href=%22http://yahoo.maps.com%22%3E[Map]%3C/a%3E%3Cbr%3EInfo: $5.00%3Cbr%3E%3Cb%3E%3Cbr%3EComments:%3C/b%3E%3Cbr%3Ehttp://www.oberlin.edu/students/links-life/sco.html%3Cbr%3E</detail3>
<dates>2004,4,18</dates>
</showd>
<showd>
<id>69</id>
<preview1>May 18, 2007 21:30</preview1>
<preview2>All Ages @ Joes Place</preview2>
<preview3>East Hollywood, CA</preview3>
<detail1>May 18th 2007 @ 8:00pm</detail1>
<WEB>http://thegypsylounge.com/</WEB>
<detail2>Bob's Pe</detail2>
<detail3>555 Santa Monica Blvd %3Cbr%3E Hollywood,Ca.90069 (714) 555-2222</detail3>
<dates>2004,5,18</dates>
</showd>
</newshows>