XML path problem from within .swf

awilderbeast
awilderbeast used Ask the Experts™
on
I have an index page in the root of my website which contains a .swf. The .swf is located in /includes/flash/ folder along with the XML file it loads.

I have tried accessing the XML file using /xmlfile.xml and /includes/flash/xmlfile.xml and neither work from the index page. However if I use /xmlfile.xml path and load just the .swf file (not from index) it works and it also works if I place the entire URL to the xml file.

If someone could tell me where I'm going wrong or how to access the root of the host through AS it would be much appreciated.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
in swf if you specify a relative path then you should be testing using a web server
eg. file.xml or /file.xml or /dir/file.xml is a relative path. Flash will only be able to find this path is it is being used from a browser. It will use the browser path and append the path inside the swf to it.

When you run swf independently you are required to give the http://domain or localhost/file.xml  otherwise flash will not find the right path.

Author

Commented:
When you say it will use the browser path and append the path inside the swf to it do you mean the path from the location of the .swf or the path from the page that the .swf is included inside?
Commented:
inside the swf you would specifying the path to the xml file to load for eg. data/file.xml

when you load it from a browser by opening http://localhost/index.html then the swf file will be loaded.

then the swf checks the browser path and takes the http://localhost/ where the swf file is and adds the path inside the swf (data/file.xml)

so that loads http://localhost/data/file.xml

if you can explain what exactly youre doing and what is happening then i can have a better idea

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial