2 Replies Latest reply on Apr 20, 2012 3:05 AM by Bo_Salz

    How to urlencode parameter in dynamic HTTPService url


      I have created a small dashboard that uses a dynamic url for the HTTPService getting tha data for the chart. The url gets its querystring parameter (a username) from the flashvars in the wrapper. srv.url works fine and fills my chart when the username does not need to be urlencoded, but how do I urlencode the username as I need to do?

      This is an exerpt from the wrapper:
      <script type="text/javascript">
      var flashvars = {};
      flashvars.UserName = "Heather%20%c3%98zer";

      Comment: I intend to generate the username dynamically allthough the example above is static. The username is urlencoded in the wrapper.

      This is an exerpt from the MXML source:

      <s:Application creationComplete="initVars()" >

      public var urlXML1:String;
      private function initVars():void {
      urlXML1 = FlexGlobals.topLevelApplication.parameters.UserName;
      srv.url="http://myserver.com/xml/YourSales.aspx?UserName=" + urlXML1.toString();

      <mx:HTTPService id="srv" url=''  />

      <mx:ColumnChart id="myChart" dataProvider="{srv.lastResult.Data.Result}" ...

      Comment: urlXML1.toString() above should be urlencoded. That's my issue as I see it. I look forward to hear your advice.

      Kind regards Bo