2 Replies Latest reply on Dec 7, 2010 11:58 AM by Flex harUI

    load XML config file via URLLoader with Relative Paths

    Devtron Level 3


      Hello

       

      If I run both of these code snippets locally, these both work. But when I move this code to my server, it throws an exception...

       

      This works on my server:

       

      var request:URLRequest = new URLRequest("webserviceconfig.xml");
      var loader:URLLoader = new URLLoader();
      loader.addEventListener(Event.COMPLETE, URLLoadCompleteHandler);

       


      But this does not work on my server:

       

      var request:URLRequest = new URLRequest("../webserviceconfig.xml");
      var loader:URLLoader = new URLLoader();
      loader.addEventListener(Event.COMPLETE, URLLoadCompleteHandler);

       


      I receive the error:
      Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: ../webserviceconfig.xml

       


      My question is...

       

      C:\AllProjects\MyWebProjectFolderWithSWFFile\

       

      1.) How can my .SWF access an XML file in a directory above the application's folder (the AllProjects folder), using relative path?
      2.) I can only specify "domains" in my Cross Domain policy file. Can I specify folders? Is this a cross domain policy issue?

      3.) Is this the correct way to use the relative path? or am I missing something?

       

      URLRequest("../webserviceconfig.xml")

        • 1. Re: load XML config file via URLLoader with Relative Paths
          Devtron Level 3

          I found out you cannot achieve this, unless you use explicit URL paths.

           

          I ended up keeping my XML file in the same directory as my SWF. This will work, but I would rather have my XML file excluded from the SWF's folder, and placed somewhere else, in isolation. Afterall, this specific XML file is for webservice WSDL address location, which I do not want to include in my project. This needs to be configurable outside of the application. I shouldnt need to modify code for every single build I need to produce....

           

          Eventually I will have automated builds, which will delete all the contents from this folder. I will have to tell my automated builder to reproduce my XML config file. This really means, I need to have a duplicate copy on the file system to copy into my build folder when automating.

           

          I really wish the SWF could access any directory on the server I ask it to. Kinda lame workaround.

          • 2. Re: load XML config file via URLLoader with Relative Paths
            Flex harUI Adobe Employee

            Might be an access rights issue.