Change URL as TabNavigator changed : TabNavigator « Container « Flex

Home
Flex
1.Chart
2.Components
3.Container
4.Data Model
5.Development
6.Effects
7.Event
8.Graphics
9.Grid
10.Style
Flex » Container » TabNavigator 




Change URL as TabNavigator changed
Change URL as TabNavigator changed
      

<!--
Code from Flex Documentation "Using Adobe Flex 4".

This user guide is licensed for use under the terms of the Creative Commons Attribution 
Non-Commercial 3.0 License. 

This License allows users to copy, distribute, and transmit the user guide for noncommercial 
purposes only so long as 
  (1proper attribution to Adobe is given as the owner of the user guide; and 
  (2any reuse or distribution of the user guide contains a notice that use of the user guide is governed by these terms. 
The best way to provide notice is to include the following link. 
To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/

-->


    <!-- deeplinking/TabNavExample.mxml -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
    creationComplete="initApp()" height="250" width="500">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script> 
         
        import mx.events.BrowserChangeEvent; 
        import mx.managers.IBrowserManager; 
        import mx.managers.BrowserManager; 
        import mx.utils.URLUtil; 
        public var browserManager:IBrowserManager; 
        private function initApp():void 
            browserManager = BrowserManager.getInstance()
            browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseURL)
            browserManager.init("""Shipping")
        
        private var parsing:Boolean = false
        private function parseURL(event:Event):void 
            parsing = true
            var o:Object = URLUtil.stringToObject(browserManager.fragment)
            if (o.view == undefined
                o.view = 0
            tn.selectedIndex = o.view; 
            browserManager.setTitle((tn.selectedIndex == 0"Shipping" "Receiving")
            tn.validateNow()
            var details:Boolean = o.details == true
            if (tn.selectedIndex == 0
                shipDetails.selected = details; 
            else 
                recvDetails.selected = details; 
            parsing = false
        
        private function updateURL():void 
            if (!parsing
            callLater(actuallyUpdateURL)
        
        private function actuallyUpdateURL():void 
            var o:Object = {}
            var t:String = ""
            if (tn.selectedIndex == 1) { 
                t = "Receiving"
                o.view = tn.selectedIndex; 
                if (recvDetails.selected
                    o.details = true
            else 
                t = "Shipping"
                o.view = tn.selectedIndex; 
                if (shipDetails.selected
                    o.details = true
            
            var s:String = URLUtil.objectToString(o)
            browserManager.setFragment(s)
            browserManager.setTitle(t)
        
      
    </fx:Script>
    <mx:TabNavigator id="tn" change="updateURL()" width="300">
        <mx:Panel label="Shipping">
            <mx:CheckBox id="shipDetails" label="Show Details"
                change="updateURL()" />
        </mx:Panel>
        <mx:Panel label="Receiving">
            <mx:CheckBox id="recvDetails" label="Show Details"
                change="updateURL()" />
        </mx:Panel>
    </mx:TabNavigator>
</s:Application>

   
    
    
    
    
    
  














Related examples in the same category
1.TabNavigator EffectTabNavigator Effect
2.Put VBox into TabNavigatorPut VBox into TabNavigator
3.Add Panel to TabNavigatorAdd Panel to TabNavigator
4.Contain a Spark List control and an TabNavigator containerContain a Spark List control and an TabNavigator container
5.NavigatorContent inside a TabNavigatorNavigatorContent inside a TabNavigator
6.Put Form into TabNavigatorPut Form into TabNavigator
7.Load the modules when navigating to tabs in TabNavigatorLoad the modules when navigating to tabs in TabNavigator
8.TabNavigator creation PolicyTabNavigator creation Policy
9.Load modules when the user navigates to the appropriate tabs in TabNavigatorLoad modules when the user navigates to the appropriate tabs in TabNavigator
10.Add child component to TabNavigatorAdd child component to TabNavigator
11.Enable child of TabNavigator
12.Disable TabControls Within a TabNavigator
13.Get child count in TabNavigator
14.TabNavigator containerTabNavigator container
15.Use Button to select TabUse Button to select Tab
16.Using a tab navigator to created tabbed navigationUsing a tab navigator to created tabbed navigation
17.Responding to tab changes in a tab navigatorResponding to tab changes in a tab navigator
18.Using an event object to pass information about selected tabUsing an event object to pass information about selected tab
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.