Adobe Flex 3 Help

FileSystemHistoryButton control

The FileSystemHistoryButton control lets the user move backwards or forwards through the navigation history of another control. It works in conjunction with a FileSystemList or FileSystemDataGrid control, or any similar control with a property containing an array of File objects. The FileSystemHistoryButton is a PopUpMenuButton. It has a button for navigating back or forward one step in the history. It also has a list of history steps from which one step can be chosen.

To link a FileSystemHistoryButton to a control, bind the button's dataProvider property to one of the control's properties. The property must contain an array of File objects representing a sequence of directories in a file system browsing history. For instance, you can bind the dataProvider property to the forwardHistory or backHistory property of a FileSystemList or FileSystemDataGrid control. The button can then be used to navigate the display history of that control if you set the click and itemClick event handlers of the button to call the navigateForward() or navigateBack() method of the control.

For more information on the FileSystemHistoryButton control, see the Flex 3 Language Reference.

Contents

Creating a FileSystemHistoryButton control

You use the <mx:FileSystemHistoryButton> tag to define a FileSystemHistoryButton control in MXML, as the following example shows. Specify an id value if you intend to refer to a component elsewhere in your MXML, either in another tag or in an ActionScript block.

You specify the property to which the button is bound by setting the dataProvider property.

The following example demonstrates creating two FileSystemHistoryButton controls that are linked to the display history of a FileSystemList control. Each button's enabled property is bound to the FileSystemList control's canNavigateBack or canNavigateForward property. As a result, the button is enabled if the currently displayed directory can navigate in the appropriate direction. When the user clicks a button, its event listener calls the FileSystemList control's navigateBack() or navigateForward() method. This causes the FileSystemList control to navigate to the previous or next directory.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml">
    <mx:HBox>
        <mx:FileSystemHistoryButton label="Back" 
dataProvider="{fileList.backHistory}"
enabled="{fileList.canNavigateBack}"
click="fileList.navigateBack();"
itemClick="fileList.navigateBack(event.index)"/> <mx:FileSystemHistoryButton label="Forward"
dataProvider="{fileList.forwardHistory}"
enabled="{fileList.canNavigateForward}"
click="fileList.navigateForward();"
itemClick="fileList.navigateForward(event.index)"/> </mx:HBox> <mx:FileSystemList id="fileList"/> </mx:WindowedApplication>

FileSystemHistoryButton user interaction

The FileSystemHistoryButton is based on the Flex PopUpMenuButton, so their core functionality is the same. When the user clicks the main button the click event is dispatched (normally moving backward or forward one step in the history). In addition, by clicking the pull-down menu button, a list of the history steps is displayed. This allows the user to navigate directly to a specific step in the history.