Solved

Sort Flex FileSystemList

Posted on 2010-09-21
5
613 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
It was a pleasure! ;)
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This is intended to introduce all collision detection principles in flash, their strengths, weaknesses and workarounds. The main method for Collision Detection in flash is using hitTestObject. But unless you'll be pushing rectangular shapes without …
There are times in your Flash CS4 application when you want more than a simple pointer or a hand, and it's hard to find an ideal walk-through to tell you what to do.  I spent a few days recently learning my way around making custom cursors in Flash,…
The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

771 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now