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 }
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).
david,
Nope, the ActionScript code is “cleverly” buried within the CheckBox control’s
changeevent handler in the MXML:Peter