Sort Flex FileSystemList

How can i sort the files listed in an Adobe Flex FileSystemList object?

I am sssuming it is easy, but i am new to flex and can't seem to figure out.
Who is Participating?
heppaConnect With a Mentor Commented:
normally they should... could you post your mxml please?

an example for reverse sorting would be:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="">
            public function compareFileNames(name1:String, name2:String):int{
                  if(name1 > name2)return -1;
                  else if (name2 > name1) return 1;
                  else return 0;
    <mx:Button label="Up" click="fileList.navigateUp();"
    <mx:FileSystemList id="fileList" nameCompareFunction="compareFileNames"/>
how would you want them to be sorted?

you could write a callback function and use that function in the nameCompareFunction attribute.
trademark16Author Commented:
Just by name is fine.  Currently they do not come in that way and i want to guarantee it does.
trademark16Author Commented:
I altered your sample a bit to be not reverse soriting and it seems to work now, thanks.
It was a pleasure! ;)
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.