4 Replies Latest reply on Jan 24, 2008 3:59 PM by Greg Dove

    Flash 8 - AS2 - Cross domain XML load error

    Level 7

      Hi there,

      I'm having some problems with loading a xml file.
      Got a swf that must load a xml file from a different server.
      For different domain I inserted this code:

      System.exactSettings = false;
      System.security.allowDomain ("domain.com");

      On the html markup file I inserted:

      'allowScriptAccess', 'domain.com',

      Running on Flash IDE it all goes right, but once online there is always an
      xml load error.

      Can anyone help me?

      Thanks

        • 1. Re: Flash 8 - AS2 - Cross domain XML load error
          Greg Dove Level 4
          In order for your swf to load data from a different domain it requires a crossdomain.xml permission file at the other server to grant access to the domain where your swf resides.

          The other option is to proxy the request through a serverside script e.g. php from your own domain, so that for all intents and purposes, your swf assumes its loading the data from your domain.
          • 2. Re: Flash 8 - AS2 - Cross domain XML load error
            Greg Dove Level 4
            So a file similar to the following needs to be placed in the root directory of the other site that you are loading from... with the domain name in the file granting permission to your site.

            • 3. Re: Flash 8 - AS2 - Cross domain XML load error
              Level 7
              I GWD,

              Thanks for the reply.
              In the case bellow must I then make a reference to this xml file in the
              flash?

              I.e. System.security.loadPolicyFile(" http://foo.com/sub/dir/file.xml");

              What about the php file. would you be kind to show me an example?

              Regards
              Peter


              "GWD" <webforumsuser@macromedia.com> escreveu na mensagem
              news:fnaq3k$rk4$1@forums.macromedia.com...
              > In order for your swf to load data from a different domain it requires a
              > crossdomain.xml permission file at the other server to grant access to the
              > domain where your swf resides.
              >
              > The other option is to proxy the request through a serverside script e.g.
              > php
              > from your own domain, so that for all intents and purposes, your swf
              > assumes
              > its loading the data from your domain.
              >
              >
              • 4. Re: Flash 8 - AS2 - Cross domain XML load error
                Greg Dove Level 4
                If its not in the root directory on the other site then yes you will need to load it first from the specific location. You normally don't need to do this if its in the main root location at the other site.
                But there are some limitations with putting the file in a custom location. You should read this info:
                http://livedocs.adobe.com/flash/9.0/main/00001086.html#wp250063

                If you have the crossdomain permission set up correctly then you don't need to use the php option to proxy the requests through your own domain. I've never needed to use it (yet) so I don't have an example to show you. But others here in the forum have so may post an example.