Container Flex



    xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx"
    creationComplete="init();parseURL(event)">
    
        
    

     
         
        import mx.events.BrowserChangeEvent; 
        import mx.managers.IBrowserManager; 
        import mx.managers.BrowserManager; 
        import mx.utils.URLUtil; 
        private var bm:IBrowserManager; 
        [Bindable] 
        private var agreeBoxFromURL:Boolean; 
        [Bindable] 
        private var personNameFromURL:String; 
        [Bindable] 
        private var hometownFromURL:String; 
        [Bindable] 
        private var cctypeFromURL:int; 
        [Bindable] 
        private var ccnumberFromURL:String; 
        private function init():void { 
            bm = BrowserManager.getInstance(); 
            bm.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseURL); 
            bm.init("", "Welcome!"); 
        } 
        /* This method is called once when application starts up. It is also 
        called when the browser's address bar changes, either due to user action 
        or user navigation with the browser's Forward and Back buttons. */ 
        private function parseURL(event:Event):void { 
            var o:Object = URLUtil.stringToObject(bm.fragment, "&"); 
            if (o.panel == undefined) 
                o.panel = 0; 
            tn.selectedIndex = o.panel; 
            tn.validateNow(); 
            personNameFromURL = o.personName; 
            hometownFromURL = o.hometown; 
            ccnumberFromURL = o.ccnumber; 
            cctypeFromURL = o.cctype; 
            agreeBoxFromURL = o.agreeBox; 
        } 
        public function updateTitle(e:Event):void { 
            l1.text += "updateTitle()\n"; 
            bm.setTitle("Welcome " + personName.text + " from " + hometown.text + "!"); 
        } 
        private function updateURL():void { 
            /* Called when state changes in the application, such as when the panel changes, 
            or a checkbox is checked. 
            You must wrap the following assignments in a try/catch block, otherwise the 
            application tries to access components that have not yet been created. 
            You can circumvent this by setting the container's creationPolicy to "all", 
            but that is not a good solution for performance reasons. */ 
            try { 
                personNameFromURL = personName.text; 
                hometownFromURL = hometown.text; 
                ccnumberFromURL = ccnumber.text; 
                cctypeFromURL = cctype.selectedIndex; 
                agreeBoxFromURL = agreeBox.selected; 
            } catch (e:Error) { 
            } 
            var o:Object = {}; 
            try { 
                o.panel = tn.selectedIndex; 
                o.personName = personName.text; 
                o.hometown = hometown.text; 
                o.ccnumber = ccnumber.text; 
                o.cctype = cctype.selectedIndex; 
                o.agreeBox = agreeBox.selected; 
            } catch (e:Error) { 
            } finally { 
                var s:String = URLUtil.objectToString(o, "&"); 
                bm.setFragment(s); 
            } 
        } 
      
    

    
        
            
                
                                            focusOut="updateURL()" enter="updateURL()" />
                
                
                                            focusOut="updateURL()" enter="updateURL()" />
                
                
            

        
        
            
                
                                            selectedIndex="{cctypeFromURL}">
                        
                            Visa
                            MasterCard
                            American Express
                        

                    
                
                
                                            focusOut="updateURL()" enter="updateURL()" />
                
            

        
        
                            text="You must agree to all the following conditions..." />
                            click="updateURL()" />