The Code-Bin
Links
Home
Add your code!
All Listings
About
Latest Entry
Featured Scripts
Author's Website
Latest Entries
FFMPEG Thumbnail Scr...
PHP, 0.8KB
Jul. 29, 10:24pm
John
Z80 Assembler, 190 bytes
Feb. 17, 3:36am
John
Z80 Assembler, 176 bytes
Sep. 13, 2:19am
John
Z80 Assembler, 77 bytes
Sep. 13, 2:18am
John
Z80 Assembler, 209 bytes
Sep. 13, 2:17am
Link Bar History Management in Flex
Posted by: Priyank Kapadia | January 8, 2008 @ 6:55am
Revision 1 - Original post on January 8, 2008 @ 5:26am
Other Code
[
Download
]
[Main.mxml] <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:comp = "components.*"> <comp:HistoryWindow/> </mx:Application> [historyCode.as] import mx.managers.HistoryManager; import mx.events.ItemClickEvent; [Bindable] private var menuDataProvider:Array = new Array("home","contact","events"); private function onCreationComplete():void { HistoryManager.register(this); } private function stateChanged(event:ItemClickEvent):void { currentState = event.label; panel.title = event.label; HistoryManager.save(); } public function saveState():Object { var result:Object = {value:currentState}; return result; } public function loadState(state:Object):void { if(state == null) { state = {value:"home"}; } if(state != currentState) { panel.title = currentState = state.value; } } [HistoryWindow.mxml] <?xml version="1.0" encoding="utf-8"?> <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="400" height="300" implements="mx.managers.IHistoryManagerClient" creationComplete="onCreationComplete();" > <mx:states> <mx:State name="home"> <mx:SetProperty target="{panel}" name="height" value="100"/> </mx:State> <mx:State name="contact"> <mx:SetProperty target="{panel}" name="height" value="200"/> </mx:State> <mx:State name="events"/> </mx:states> <mx:Script source="historyCode.as" /> <mx:Panel x="0" y="0" width="400" height="300" layout="vertical" id="panel" horizontalAlign="center" verticalAlign="top" title="{bar.labelField}"> <mx:LinkBar id="bar" dataProvider="{['home','contact','events']}" itemClick="stateChanged(event);" /> </mx:Panel> </mx:Canvas>
Syntax Highlighting
[
Open in new window
]
Author Comments
working with custom history management
Rating
4.49 / 8
189 Votes