Apache Flex 4.16.0 API Reference | All Packages | All Classes | Index | Frames No Frames |
IHistoryManagerClient

Package | mx.managers
Interface | public interface IHistoryManagerClient
Implementors | Accordion, ViewStack

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Interface that must be implemented by objects registered with the History Manager. The methods in this interface are called by the HistoryManager when saving and loading the history state of the application.

This interface is implemented by the Flex navigator containers TabNavigator, Accordion, and ViewStack. It must be implemented by any other component that is registered with the HistoryManager.

See also

mx.managers.HistoryManager

Public Methods

| Method | Defined By
--- | --- | ---
|  | loadState(state:Object):void Loads the state of this object. | IHistoryManagerClient
|  | saveState():Object Saves the state of this object. | IHistoryManagerClient
|  | toString():String Converts this object to a unique string. | IHistoryManagerClient

Method Detail

loadState | () | method

`public function loadState(state:Object):void`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Loads the state of this object.

Parameters

| `state:Object` — State of this object to load. This will be null when loading the initial state of the application.

Example
The following code loads the selected index and search string from the saved state.

    	  public function loadState(state:Object):void
    	  {
    	  	// First, check to see if state is null. When the app is reset
    	  	// back to its initial state, loadState() is passed null.
    	  	if (state == null)
    	  	{
    	 		myList.selectedIndex = -1;
    	  		mySearchInput.text = "";
    	  	}
    	  	else
    	  	{
    	  		myList.selectedIndex = state.selectedIndex;
    	  		mySearchInput.text = state.searchString;
    	  	}
    	  }

saveState | () | method |

`public function saveState():Object`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Saves the state of this object. The object contains name:value pairs for each property to be saved with the state.

The History Manager collects the state information from all components and encodes the information in a URL format. Most browsers have a length limitation on URLs, so the state information returned should be as minimal as possible.

Returns

| `Object` — The state of this object.

Example
The following code saves the selected index from a List, and a search string.

    	  public function saveState():Object
    	  {
    	  	var state:Object = {};
    	 	  	state.selectedIndex = myList.selectedIndex;
    	  	state.searchString = mySearchInput.text;
    	 	  	return state;
    	 }

toString | () | method |

`public function toString():String`

Language Version : | ActionScript 3.0

Product Version : | Flex 3

Runtime Versions : | Flash Player 9, AIR 1.1

Converts this object to a unique string. Implemented by UIComponent.

Returns

| `String` — The unique identifier for this object.

Sun Mar 5 2017, 03:42 PM +11:00