Using standard history management

History management is available by default for the Accordion and TabNavigator navigator containers. It is disabled by default for the ViewStack navigator container. When history management is enabled, as the user navigates within different navigator containers within an application, each navigation state is saved. Selecting the web browser's back or forward browser command displays the previous or next navigation state that was saved. History management keeps track of where you are in an application, but it is not an undo and redo feature that remembers what you have done.

Note: When history management is enabled for a particular component, such as a navigator container, only the state of the navigator container is saved. The state of any of the navigator container's child components is not saved unless history management is specifically enabled for that component.

For information about how the navigation state is saved and restored, see How the HistoryManager class saves and loads state.

Flex automatically enables history management for the following navigator containers:

To enable history management for a navigator container, you set the container's historyManagement property to true, as the following example shows:

<mx:TabNavigator historyManagement="true">

You can disable or enable history management for a navigator container by setting the container's historyManagement property to false or true, respectively. The following example shows a TabNavigator container with history management enabled:

<mx:TabNavigator historyManagement="true">

In the following example, the user's panel sections are saved for the first Accordion container because it uses default settings, but the second Accordion container has the historyManagement property explicitly set to false. When the user selects the web browser's back or forward command, the previous or next state is displayed for the first container, but not for the second.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" width="600" height="800">

   <!-- History management is enabled by default for this Accordion. -->
   <mx:Accordion width="100%" height="50%">
      <mx:VBox label="View 1">
         <mx:TextInput text="View 1" />
      </mx:VBox>
      <mx:VBox label="View 2">
         <mx:TextInput text="View 2" />
      </mx:VBox>
   </mx:Accordion>

   <!-- History management is disabled for this Accordion. -->
   <mx:Accordion historyManagement="false" width="100%" height="50%">
      <mx:VBox label="View 1">
         <mx:TextInput text="View 1" />
      </mx:VBox>
      <mx:VBox label="View 2">
         <mx:TextInput text="View 2" />
      </mx:VBox>
   </mx:Accordion>
</mx:Application>

You can disable history management for an entire application by requesting a myapp.mxml.swf file directly or in a custom HTML wrapper page that does not use history management. For more information about customizing the HTML wrapper, see Deploying Applications.


Version 1.5

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/15/flex_docs_en/00000632.htm