Solved

Sort Flex FileSystemList

Posted on 2010-09-21
5
616 Views
Last Modified: 2013-11-11
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.
0
Comment
Question by:trademark16
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:heppa
ID: 33732905
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
 

Author Comment

by:trademark16
ID: 33733636
Just by name is fine.  Currently they do not come in that way and i want to guarantee it does.
0
 
LVL 4

Accepted Solution

by:
heppa earned 500 total points
ID: 33733757
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
 

Author Comment

by:trademark16
ID: 33743964
I altered your sample a bit to be not reverse soriting and it seems to work now, thanks.
0
 
LVL 4

Expert Comment

by:heppa
ID: 33743988
It was a pleasure! ;)
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question