topical media & game development
professional-flex-code-08-ToggleHistoryButtonBar.mx
professional-flex-code-08-ToggleHistoryButtonBar.mx
[swf]
flex
<?xml version="1.0"?>
<mx:ToggleButtonBar xmlns:mx="http://www.adobe.com/2006/mxml" initialize="registerManager()" itemClick="buttonClicked()" implements="mx.managers.IHistoryManagerClient">
<mx:Script>
<![CDATA[
import mx.managers.HistoryManager;
// method to register with HistoryManager
private function registerManager():void {
HistoryManager.register(this);
}
// called when button is clicked
private function buttonClicked():void {
HistoryManager.save();
}
// Save the selectedIndex. ** Required Method **
public function saveState():Object {
return { selectedIndex: selectedIndex };
}
// Load the selectedIndex ** Required Method **
public function loadState(state:Object):void {
var newIndex:int = state ? int(state.selectedIndex) : -1;
if (newIndex != selectedIndex)
selectedIndex = newIndex;
}
]]>
</mx:Script>
</mx:ToggleButtonBar>
(C) Æliens
04/09/2009
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.