0 Replies Latest reply on Nov 10, 2009 1:04 PM by FALCONSEYE_

    help with picking up dynamic url

    FALCONSEYE_

      Basically, I am trying to get the url from the application, and set some rules so that flex will call the right ColdFusion template depending on what server this application is running on like dev, staging or production. The application is for uploading a csv file. A coldfusion page reads some values from the csv file, and inserts/updates some db records.

       

      I have the following:

       

       

      [Bindable] private var _strDomain:String = new String("http://dev.domain.com/");
                  [Bindable] private var _strUploadScript:String = new String(_strDomain + "ubs/upload.cfm");
                  private var unid:int = 0;//Application.application.parameters.unid;
                 
                  // Initalize
                  public function initApp():void {
                         
                      _strDomain = mx.core.Application.application.url;
                      var index:int = _strDomain.indexOf("/Intranet");
                      _strDomain = _strDomain.substr(0, index);
                      _strUploadScript = _strDomain + "/Intranet/ubs/upload.cfm";
                         
                      mx.controls.Alert.show('a:'+_strUploadScript);
                      Security.allowDomain('*');

       

       

      there are several issues. if i get rid of all the stuff in initApp and run this in dev by calling:

      http://dev.domain.com/ubs/upload.cfm

      it works great.

       

      It doesn't seem like initApp() changes the _strDomain, _strUploadScript right. If i get rid of the above vars, then I get all sorts of 'access of undefined property errors'.

       

      The initApp is called by  creationComplete="initApp()". I am new to flex 3/as 3 and cannot resolve this issue. What am I doing wrong? thanks in advance.