5 Replies Latest reply on Jul 14, 2008 10:10 AM by strayhand

    XML won't load from server, loads locally

    strayhand
      I can't seem to get my project to load my XML file when I place everything on the server. It works fine when i preview it using the Flash Player. But when it's loaded into an HTML page on the server I get nothing. I'm using jquery to dynamically insert the flash object into the page (In development here.). The flash object is actually several folders deeper than the page calling it, and the XML file is being referenced at the same level as the flash file itself. I also went through the trouble of putting a crossdomain.xml file on the server (plu.edu) but that didn't seem to fix anything.

      Here's my zipped project.

      Where am I doing wrong?

      Thanks.
        • 1. Re: XML won't load from server, loads locally
          Gregory Lafrance Level 6
          The only two things I can think of are:

          - perhaps the xml file must be in the same folder as the SWF
          - perhaps you need the full URL of the xml file
          • 2. Re: XML won't load from server, loads locally
            VarioPegged Level 2
            If the HTML page and SWF file are not in the same folder, the XML file should be relative to the HTML page containing the SWF, not the SWF itself.

            HTML:
            <embed src="subfolder1/subfolder2/subfolder3/subfolder4/flexApp.swf" .... >

            Flex Application XML path:
            ...
            var url:String = subfolder1/subfolder2/subfolder3/subfolder4/features.xml";
            var loader:URLLoader = new URLLoader(new URLRequest(url));
            ...

            TS
            • 3. Re: XML won't load from server, loads locally
              levancho Level 3
              this is the problem :
              <embed .. src="/admission/_flash/feature/bin-release/main.swf" ......./>

              and flash player is trying to load it as features.xml but features.xml is not under root its under /admission/_flash/feature/bin-release/ folder.

              either move your xml file under root. ooor change the path, oor change relative reference when you load xml via URLLOader into absolute .



              • 4. Re: XML won't load from server, loads locally
                strayhand Level 1
                Wow. Thanks for the responses guys. I'll try playing around with the file location/path when I get back in the office later today. I figured it wasn't a crossdomain.xml issue since both the swf and xml file were on the same domain. This makes much more sense.

                Thanks.
                • 5. Re: XML won't load from server, loads locally
                  strayhand Level 1
                  Thanks to everyone who responded to this post. For anyone else reading this post trying to get XML to load correctly, my problem was pertaining to the path of the XML file. To remedy this issue I set a default path that was relative to the .swf file. Then I used flashvars in the javascript to pass the location of the XML file. This allows me to preview my flex application locally and in a production environment when it's inserted into a page. I'll post my flex and javascript code for anyone interested. I'm using jquery and the flash plugin.

                  Thanks.