Update URL with BrowserManager : BrowserManager « Development « 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 » Development » BrowserManagerScreenshots 
Update URL with BrowserManager
Update URL with BrowserManager
         

<!--
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/UpdateURLExample.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="init();">
    <s:layout>
        <s:VerticalLayout />
    </s:layout>
    <fx:Script> 
         
        import mx.events.BrowserChangeEvent; 
        import mx.managers.IBrowserManager; 
        import mx.managers.BrowserManager; 
        import mx.utils.URLUtil; 
        private var browserManager:IBrowserManager; 
        private function init():void 
            browserManager = BrowserManager.getInstance()
            browserManager.addEventListener(BrowserChangeEvent.APPLICATION_URL_CHANGE,logURLChange)
            browserManager.init("""Welcome!")
        
        public function updateTitle(e:Event):void 
            browserManager.setTitle("Welcome " + ti1.text + " from " + ti2.text + "!")
        
        private function updateURL(event:Event):void 
            var s:String = "panel=" + event.currentTarget.selectedIndex; 
            browserManager.setFragment(s)
        
        private function logURLChange(event:BrowserChangeEvent):void 
            ta1.text += "APPLICATION_URL_CHANGE event:\n"
            ta1.text += " url: " + event.url + "\n"// Current URL in the browser. 
            ta1.text += " prev: " + event.lastURL + "\n"// Previous URL. 
        
      
    </fx:Script>
    <mx:TabNavigator id="tn" width="300" change="updateURL(event)">
        <mx:Panel label="Personal Data">
            <mx:Form>
                <mx:FormItem label="Name:">
                    <mx:TextInput id="ti1" />
                </mx:FormItem>
                <mx:FormItem label="Hometown:">
                    <mx:TextInput id="ti2" />
                </mx:FormItem>
                <mx:Button id="b1" click="updateTitle(event)" label="Submit" />
            </mx:Form>
        </mx:Panel>
        <mx:Panel label="Credit Card Info">
            <mx:Form>
                <mx:FormItem label="Type:">
                    <mx:ComboBox>
                        <mx:dataProvider>
                            <fx:String>Visa</fx:String>
                            <fx:String>MasterCard</fx:String>
                            <fx:String>American Express</fx:String>
                        </mx:dataProvider>
                    </mx:ComboBox>
                </mx:FormItem>
                <mx:FormItem label="Number:">
                    <mx:TextInput id="ccnumber" />
                </mx:FormItem>
            </mx:Form>
        </mx:Panel>
        <mx:Panel label="Check Out">
            <mx:TextArea id="ta2"
                text="You must agree to all the following conditions..." />
            <mx:CheckBox label="Agree" />
        </mx:Panel>
    </mx:TabNavigator>
    <mx:TextArea id="ta1" width="580" height="400" />
</s:Application>

   
    
    
    
    
    
    
    
    
  
Related examples in the same category
1.Use BrowserManagerUse BrowserManager
2.Using URLUtil and BrowserManager to get information about the URL that was used to return the application.Using URLUtil and BrowserManager to get information about the URL that was used to return the application.
3.Set Browser titleSet Browser title
4.Pass URL Parameters As FragmentsPass URL Parameters As Fragments
5.URL Change LoggerURL Change Logger
w___w___w___.__j___a___v__a__2__s__.___c__o___m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.