Toggling file extensions on the FileSystemTree control in Adobe AIR

by Peter deHaan on December 14, 2008 · 2 comments

in FileSystemTree

The following example shows how you can toggle file name extensions on the Adobe AIR FileSystemTree control by setting the showExtensions property.

Full code after the jump.

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2008/12/14/toggling-file-extensions-on-the-filesystemtree-control-in-adobe-air/ -->
<mx:WindowedApplication name="FileSystemTree_showExtensions_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle">
 
    <mx:ApplicationControlBar dock="true">
        <mx:CheckBox id="checkBox"
                label="showExtensions:"
                labelPlacement="left"
                selected="true" />
    </mx:ApplicationControlBar>
 
    <mx:FileSystemTree id="tree"
            showExtensions="{checkBox.selected}"
            width="100%"
            height="100%" />
 
</mx:WindowedApplication>

You can also set the showExtensions property using ActionScript, as seen in the following example:

<?xml version="1.0" encoding="utf-8"?>
<!-- http://airexamples.com/2008/12/14/toggling-file-extensions-on-the-filesystemtree-control-in-adobe-air/ -->
<mx:WindowedApplication name="FileSystemTree_showExtensions_test"
        xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle">
 
    <mx:ApplicationControlBar dock="true">
        <mx:CheckBox id="checkBox"
                label="showExtensions:"
                labelPlacement="left"
                selected="true"
                change="tree.showExtensions = checkBox.selected;" />
    </mx:ApplicationControlBar>
 
    <mx:FileSystemTree id="tree"
            width="100%"
            height="100%" />
 
</mx:WindowedApplication>

{ 2 comments… read them below or add one }

1 david 01.09.09 at 5:27 pm

Thanks for these air examples!
I think you forgot the actionscript code in the second example (it appears to be the same mxml code as in the first example).

2 Peter deHaan 01.09.09 at 5:33 pm

david,

Nope, the ActionScript code is “cleverly” buried within the CheckBox control’s change event handler in the MXML:

tree.showExtensions = checkBox.selected;

Peter

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">

Previous post:

Next post: