How can I output xml info in numerical order?

Hello all,
I have a calendar movie which receives dates info from an xml file (such as events, appointments, etc)

My problem is that the events appear in my movie’s dynamic text box in the order in which they are placed in the xml. Each event in the xml file has a day number, title, description and url link.

How can I get the events to display in numerical order from smallest to largest according to the day number instead of having to do it manually?

Hope this makes sense :slight_smile:

Here’s the AS:

function chgMonth(mnth)
{
    activeDate = new Date(activeDate.getFullYear(), mnth, activeDate.getDate());
    gotoAndPlay(4);
} // End of the function
function chgYear(yr)
{
    activeDate = new Date(yr, activeDate.getMonth(), activeDate.getDate());
    gotoAndPlay(4);
} // End of the function
function initCalander()
{
    for (i = firstDay; i < lastDay + firstDay; i++)
    {
        theDay = eval(i);
        theDay.dayNumber = i - firstDay + 1;
        theDay.gotoAndStop(2);
    } // end of for
    if (activeDate == today)
    {
        tellTarget(todayDay + firstDay - 1)
        {
            gotoAndStop(3);
        } // End of TellTarget
        with (ring)
        {
            todayDayCal = eval(todayDay + firstDay - 1);
            _alpha = 80;
            _width = todayDayCal._width;
            _height = todayDayCal._height;
            _x = todayDayCal._x;
            _y = todayDayCal._y;
        } // End of with
    } // end if
} // End of the function
function initEvents()
{
    for (j = 0; j < currEventset.childNodes.length; j++)
    {
        currAttribs = currEventset.childNodes[j].attributes;
        if (currAttribs.link.length)
        {
            montheventspanel = montheventspanel + unescape("<font color=\'#FF0000\'><b>" + currAttribs.day + "   </b> <a href=\'http://" + currAttribs.link + "\' target=\'_blank\'><font color=\'#CCCCCC\'><b><u>" + currAttribs.title + "</b></u><br></font></a></font> <font size=\'-2\'>" + currEventset.childNodes[j].firstChild.firstChild.nodeValue + "</font><br><a href=\'http://" + currAttribs.link + "\' target=\'_blank\'><font size=\'-2\' color=\'#990000\'>[ VIEW FLYER ]<br><br></font>");
        }
        else
        {
            montheventspanel = montheventspanel + unescape("<font color=\'#ffffff\'><b>" + currAttribs.day + " </b>" + currAttribs.title + "</font> <font size=\'-1\'>" + currEventset.childNodes[j].firstChild.firstChild.nodeValue + "</font><br>");
        } // end else if
        tellTarget(parseInt(currAttribs.day) + firstDay - 1)
        {
            gotoAndStop(4);
        } // End of TellTarget
    } // end of for
    if (currEventset.childNodes.length == 0)
    {
        montheventspanel = "no events scheduled";
    } // end if
} // End of the function
var today = new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());
_parent.activeDate = new Date(_parent.chosenYear, _parent.chosenMonth, _parent.chosenDate);
activeDate = _parent.activeDate;
var eventsData = _parent.xmlData.currentEvents.xmlObj;

Here’s the XML:

<yearevents year="2006">

<month id="0" name="January">
<event day="15" title="TEST 3" type="fest" link="www.google.com"><description>This is the event description</description></event>
<event day="19" title="TEST 3" type="fest" link="www.google.com"><description>This is the event description</description></event>
<event day="30" title="TEST 3" type="fest" link="www.google.com"><description>This is the event description</description></event>
</month>


<month id="1" name="February">
<event day="5" title="TEST 3" type="fest" link="www.google.com"><description>This is the event description</description></event>
<event day="11" title="TEST 3" type="fest" link="www.google.com"><description>This is the event description</description></event>
</month>

</yearevents>