14.5. FileSystemComboBox

The FileSystemComboBox is the last of the file system components. It accepts the same directory property as the other file system components that we have previously covered. It will always allow you to see the full path from the file set as the directory property back up to the root of the file system. To demonstrate this, add <mx:FileSystemComboBox id="fscb" x="384" y="419" width="240"/> to the Chapter14_Comps.mxml file. Next add fscb.directory = file; to the end of the showFileDetails() method. This will set the directory property of the FileSystemComboBox to the selected folder of the FileSystemTree. The results can be seen in Figure 14-9.

Figure 14-9. The FileSystemComboBox.
Example 14-7. The completed version of Chapter14_Comps.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="absolute" width="650" height="550">

    <mx:Script>
        <![CDATA[
            import mx.controls.FileSystemEnumerationMode;
            import flash.filesystem.File;

            public function showFileDetails():void {
                var file:File = fst.selectedItem as File;
                log.text += "name: " + file.name  + " size: " + file.size + "\n";
                log.text += "          nativepath: " + file.nativePath + "\n";
                fscb.directory = file;
            }
]]> </mx:Script> <mx:FileSystemDataGrid id="fsdg" horizontalCenter="0" y="10" width="600" height="250" enumerationMode="{FileSystemEnumerationMode.FILES_FIRST}" ...

Get Beginning Adobe® AIR™: Building Applications for the Adobe Integrated Runtime now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.