Skip to content

Toggling file extensions on the FileSystemTree control in Adobe AIR

by Peter deHaan on December 14th, 2008

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>

From → FileSystemTree

2 Comments
  1. david permalink

    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. 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 Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS