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.
trademark16Asked:
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="http://www.adobe.com/2006/mxml">
<mx:Script>
      <![CDATA[
            public function compareFileNames(name1:String, name2:String):int{
                  if(name1 > name2)return -1;
                  else if (name2 > name1) return 1;
                  else return 0;
            }
      ]]>
</mx:Script>
    <mx:Button label="Up" click="fileList.navigateUp();"
        enabled="{fileList.canNavigateUp}"/>
    <mx:FileSystemList id="fileList" nameCompareFunction="compareFileNames"/>
</mx:WindowedApplication>
0
 
heppaCommented:
how would you want them to be sorted?

you could write a callback function and use that function in the nameCompareFunction attribute.

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/FileSystemList.html#nameCompareFunction
0
 
trademark16Author Commented:
Just by name is fine.  Currently they do not come in that way and i want to guarantee it does.
0
 
trademark16Author Commented:
I altered your sample a bit to be not reverse soriting and it seems to work now, thanks.
0
 
heppaCommented:
It was a pleasure! ;)
0
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.