1 Reply Latest reply on Aug 30, 2007 7:59 AM by levancho

    hard coded url

      In my flex application I am hardcoding the url for the server as well.


      <mx:HTTPService id="isAuthorized" url=" http://Krf:8080/servlet/accountServlet"

      In my case since I am deploying the flex code as a part of the same ear as the server side code is deployed, is there a way that the flex app can read the address of the underlying machine? So that where ever this code is deployed it dynamically reads the address where it is deployed rather than being hardcoded.
        • 1. hard coded url
          levancho Level 3
          I use util method :

          public static function getURLFromAddress(_string:String, _includeLastSlash:Boolean=false) : String {
          return _string.substring(0,(_string.lastIndexOf("/")+(_includeLastSlash?1:0)));


          passing: Application.application.url

          it seems to work fine.

          but in your case it will not work because its baed on lastIndex of "/" not sure if thats what you need.