1 Reply Latest reply on Dec 6, 2010 9:32 AM by Andrew Buza

    Security error accessing url with crossdomain.xml in InDesign FlexUI

    Andrew Buza

      I'm evaluating Flex as a UI component in an InDesign script. Part of what it needs to do involves retrieving some data from a web server to be displayed in a datagrid. I've written a server running on localhost that will provide this data. Everything works fine when I run the component from Flash Builder or from the HTML wrapper page that is generated during the release build, but once I copy the .swf to the InDesign scripts folder and load it as part of a ScriptUI component, I get a fault response ("security error accessing url") when connecting to the server. I'm running this bit of code in from my Flex client:

       

      var h:HTTPService = new HTTPService();
      h.url = "http://localhost:8080/elements";
      h.method = "GET";
      h.addEventListener("result", getElementsResult);
      h.addEventListener("fault", getElementsFault);
      h.send();

       

      From what I've read, I may need a crossdomain.xml file at the root of my host, so I've added that to the server and can see that it is being accessed whenever the flex component attempts to connect to the service.

       

      My crossdomain.xml file is:

       

      <?xml version="1.0" ?>
      <!DOCTYPE cross-domain-policy SYSTEM 'http://www.adobe.com/xml/dtds/cross-domain-policy.dtd'>
      <cross-domain-policy>
          <allow-access-from domain="*"/>
      </cross-domain-policy>
      

       

      which seems to be correct, from what I understand. I've also tried quite a few other variations (setting explicit site-control policies, etc.). I'm quite new to Flex/Flash and I'm basically stuck at this point. Where might I be going wrong?