0 Replies Latest reply on Mar 22, 2013 11:10 AM by tpyy

    LocationChangeEvent holds a wrong location

    tpyy

      I'm developing an Android app using flash builder. In my app, I have a StageWebView and I need the ability to review location change events as I want some of the links to be redirected to the browser.

      The logic I have is quite simple:

      In my init() function I create the StageWebView:

      webView.viewPort = new Rectangle(5, 100, screenWidth-10, screenHeight-40);
      webView.addEventListener(LocationChangeEvent.LOCATION_CHANGING, onLocationChanging);
      webView.loadURL("http://my.domain.com/");
      

      Then I set the onLocationChanging method

      protected function onLocationChanging(event:LocationChangeEvent):void
      {
          trace("Location change: " + event.toString());
      }
      

      Now, when testing this I'm going into http://my.domain.com where I have a link to http://other.domain.com/?a=111&b=222&c=3%263&d=444

      When I run this in the adobe simulator, I get the (expected) trace below

      Location change: [LocationChangeEvent type="locationChanging" bubbles=false cancelable=true eventPhase=2 location="http://other.domain.com/?a=111&b=222&c=3%263&d=444"]
      

      However, when I run this on the Android device (using Android 4.2.2) I get

      Location change: [LocationChangeEvent type="locationChanging" bubbles=false cancelable=true eventPhase=2 location="http://other.domain.com/?a=111&b=222&c=3&3&d=444"]
      

      Note the value on the c parameter. It seems that when running on android the string is being decoded before it is being set in the event.location value. This behavior prevents me from handling the real parameters that are being transferred.

       

      Any idea why this happen? How can I fix this behavior (or hack around it)?