A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Sorting an XML List

  1. #1
    Senior Member
    Join Date
    Jul 2000
    Posts
    131

    Sorting an XML List

    This seems like it should be a simple fix, but I'm getting hung up someplace.

    I've loaded up an xml and that was pretty easy, but for some reason I can't sort the data in the xml.

    I then put the xml directly into the code so I could limit down the possibility of errors. It traces out nicely, just like the loaded xml, but this sorting command is prematurely aging me.

    Code:
    var xml:XML = <alist>
    			<student name="Darrin Fletcher" films="4" />
    			<student name="Tracie Fletcher" films="5" />
    			<student name="Chet Thomas" films="7" />
    		     </alist>;
    				
    var sl:XMLList = xml.student;
    var item:XML;
    for each(item in sl) {
    	sort(item.attribute('films'));
    	trace('Name: ' + item.attribute('name'));
    }

  2. #2
    Senior Member
    Join Date
    Jul 2000
    Posts
    131
    scouring the web like a madman, I've found a few solutions but none are simple. This seems like a simple function that the XMLList should have had incorporated directly into it.

    Dumb.

    If anyone has a simple solution, I'd love to hear it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center