# Help needed ! Sort random XML elements by date?

**URL:** https://forum.kirupa.com/t/help-needed-sort-random-xml-elements-by-date/203352
**Category:** Uncategorized
**Created:** [October 10, 2006, 12:41pm UTC](https://forum.kirupa.com/t/help-needed-sort-random-xml-elements-by-date/203352 "2006-10-10T12:41:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![superman55](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/superman55/32/1954_2.png) [@superman55](https://forum.kirupa.com/u/superman55)
#### Post date: [October 10, 2006, 12:41pm UTC](https://forum.kirupa.com/t/help-needed-sort-random-xml-elements-by-date/203352/1 "2006-10-10T12:41:21Z")

</div>

Hello,

I need to load random text message from xml to Flash but sorted by attributes “Date”.

Can anyone help me, please ?

thank you !

ActionScript Code:

[FONT=Courier New][LEFT][COLOR=#000000] **function** [/COLOR] set\_the\_varCOLOR=#000000[/COLOR]  
[COLOR=#000000]{[/COLOR]  
total\_elements = list\_xml.[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR].[COLOR=#0000ff]length[/COLOR] - [COLOR=#000080]1[/COLOR];  
btn.[COLOR=#000080]the\_text[/COLOR] = list\_xml.[COLOR=#0000ff]firstChild[/COLOR].[COLOR=#0000ff]childNodes[/COLOR][COLOR=#000000][[/COLOR][COLOR=#0000ff]random[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]attributes[/COLOR].[COLOR=#0000ff]text[/COLOR];  
[COLOR=#000000]}[/COLOR][/LEFT]  
[/FONT]  
my [COLOR=#0000ff]list[/COLOR].[COLOR=#0000ff]xml[/COLOR] code:

```auto

<?xml version="1.0" encoding= "UTF-8" ?> 
<elements>
<item text = "text message 1" date = "10/10" />
<item text = "text message 2" date = "9/10" />
<item text = "text message 3" date = "9/10" />
<item text = "text message 4" date = "10/10" />
<item text = "text message 5" date = "9/10" />
</elements>

```
