?
Solved

Sort Flex FileSystemList

Posted on 2010-09-21
5
Medium Priority
?
622 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
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 …
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.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.
Suggested Courses

743 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