1
votes

So... I have some little flash graphs I made that pull data from an xml file and also expect a flashVar in the html. The flash checks the flashVar against the data in the xml file and then proceeds to display some numbers.

The problem arises when we put the swfs and xmls on the server. The flash just wont load the xml files. It will however load the xml files if they are placed on the root of the server. Strange right ?

In the flash the xmls are loaded on the same level. If I upload the swf's to a folder with the xmls files and call the flash into an html page (not on the same level) they wont load. For instance in the html I have:

param name="movie" value="/assets/flash/flashgraph-05.swf"

This is what I have inside the FLA / SWF

var xmlLoader:URLLoader = new URLLoader();
xmlLoader.addEventListener(Event.COMPLETE, showXML);
xmlLoader.load(new URLRequest("myXML.xml"));

I would have thought as long as the XML and the SWF are together then the above should work right? However if I make a fixed path in the FLA to the XML it will work.

xmlLoad.load(new URLRequest("http://mysite.com/assets/flash/myXML.xml"));

I'm really stumped on this. If anyone has any ideas I'd be truly grateful.

1
i must add that i want the link to be relative so that we can move the SWFs and XMLs around the site without having to open up flash to change a link each time :) - Tim

1 Answers

1
votes

When you embed a SWF in HTML, any relative path is relative to that HTML path. They are not relative to the SWF location. As the HTML is not in the same directory of SWF, you need to modify the paths accordingly.