5 Replies Latest reply on Sep 24, 2010 6:14 PM by laxmidi

    Drowning in Deeplinking -- Need Help

    laxmidi

      Hi,

       

      I need some help with deeplinking. I've got a weird problem. I set-up deeplinking and everything was working fine. I could use the back button and I could paste the url in the browser and it would open to the appropriate "page".

       

      I set-up the deeplinking using the ViewStack's selected index as the fragment to set. So www.mysite.com/#a=2, for example with 2 being the viewstack's selected index. This worked fine.

       

      //ORIGINAL WORKING
      private function initBrowserManager():void {
          browserManager = BrowserManager.getInstance();
          browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseUrl)
          browserManager.init("", "My Website Title");
          parseUrl();  
      }
      
      private function updateUrl():void {
       browserManager.setFragment("a="+ mainViewStack.selectedIndex);
      
      }
      
      

       

       

      But, I didn't want to use the selected indexes as they change when I add content and more importantly, I wanted SEO friendly URLs that contained words. So, the URL would be, for example, www.mysite.com/#view=my_cool_stuff. So, I took the viewstack id's, replaced the underscores with dashes and I also capitalized the page titles. This is what I've got:

       

       

      //NEW Version with Problems
      private function initBrowserManager():void {
          browserManager = BrowserManager.getInstance();
          browserManager.addEventListener(BrowserChangeEvent.BROWSER_URL_CHANGE, parseUrl)
          browserManager.init("", "My Website Title");
          parseUrl();
      
      }
      
      private function updateUrl():void {
      
              var selectedStack:String = mainViewStack.selectedChild.id;    
              var dashedURLFragment:String = selectedStack.replace(/_/g,"-");
              var withoutUnderscore:String = selectedStack.replace(/_/g," ");
              var capitalizeTitle:String = withoutUnderscore.replace(/\b./g, function(...m):String{return m[0].toUpperCase()});
      
             //page title
              capitalizeTitle = capitalizeTitle.replace(/Sat/g,"SAT ");
              var newTitle:String = capitalizeTitle.replace(/Ma/g,"MA")
              browserManager.setTitle("My Website | " + newTitle); 
      
           browserManager.setFragment("view="+dashedURLFragment); 
      }
      
      

       

       

       

      The back button works fine in the new version. The page titles appear fine. The url fragments are added in the pages. BUT, if I copy a url and paste it into the browser it goes to my main "page" instead of the one it was supposed to go to. I tested the copy and paste into the browser on a map page in the new and old version. I navigated to the correct page in the old version, but not the new version. What's happening? I really need some help.

       

      Thank you.

       

      -Laxmidi