The following code shows how you can toggle the visibility of the Type column in the Adobe AIR FileSystemDataGrid control by setting the typeColumn object’s visible property.
Full code after the jump.
<?xml version="1.0" encoding="utf-8"?> <!-- http://airexamples.com/2008/12/18/toggling-the-type-column-on-the-filesystemdatagrid-control-in-adobe-air/ --> <mx:WindowedApplication name="FileSystemDataGrid_typeColumn_visible_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"> <mx:Script> <![CDATA[ import mx.events.FileEvent; private function checkBox_click(evt:Event):void { dataGrid.typeColumn.visible = checkBox.selected; } private function dataGrid_directoryChange(evt:FileEvent):void { application.status = evt.file.nativePath; } ]]> </mx:Script> <mx:ApplicationControlBar dock="true"> <mx:CheckBox id="checkBox" label="typeColumn.visible" selected="true" change="checkBox_click(event);" /> </mx:ApplicationControlBar> <mx:FileSystemDataGrid id="dataGrid" directoryChange="dataGrid_directoryChange(event);" width="100%" height="100%" /> </mx:WindowedApplication>
{ 0 comments… add one now }