Data Model Flex


    
        
            import mx.events.BrowserChangeEvent;
            import mx.managers.IBrowserManager;
            import mx.managers.BrowserManager;
            import mx.utils.URLUtil;
            private var bm:IBrowserManager= BrowserManager.getInstance();
            private function onCreationComplete():void
            {
                bm.init();
                var o:Object = URLUtil.stringToObject(bm.fragment);
                firstName.text = o.firstName;
                lastName.text = o.lastName;
                bm.addEventListener( BrowserChangeEvent.BROWSER_URL_CHANGE, onURLChange );
            }
            private function updateURL():void
            {
                bm.setFragment( "firstName=" + firstName.text + ";lastName=" + lastName.text );
            }
            private function onURLChange( event : BrowserChangeEvent ):void
            {
                var o:Object = URLUtil.stringToObject(bm.fragment);
                firstName.text = o.firstName;
                lastName.text = o.lastName;
            }