# Reading local XML file

**URL:** https://forum.kirupa.com/t/reading-local-xml-file/267496
**Category:** flash
**Created:** [August 1, 2008, 8:27pm UTC](https://forum.kirupa.com/t/reading-local-xml-file/267496 "2008-08-01T20:27:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![AlexWeldon](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@AlexWeldon](https://forum.kirupa.com/u/AlexWeldon)
#### Post date: [August 1, 2008, 8:27pm UTC](https://forum.kirupa.com/t/reading-local-xml-file/267496/1 "2008-08-01T20:27:30Z")

</div>

Hi, I’m having a problem with Flex. When I make a Flex app that reads a local XML file, it works when I run it from the bin-debug directory, and it works when I run it from my website, but if I copy it to another directory on my hard disk (along with the XML file), it can no longer open the XML file… even if I copy the entire bin-debug directory and paste it directly into another folder on my hard drive, when I open the HTML file (with the call to the SWF file) in my browser, the app loads up successfully, but it behaves as if the XML file isn’t there.

I guess it must be a permissions thing, but if it works from the bin-debug directory, there must be a way to make it work in other directories. It’s important, because I’m making an engine for browser-based point-and-click adventure games, and I need the game developers to be able to keep a local copy of the SWF to test out their game as they’re making it, without needing to upload it to a website.

I’m on a PPC Mac G5, running OS 10.4.11

Here’s an example of the way I’m reading the XML files, in case that makes a difference.:

\<mx:Application xmlns:mx=“[http://www.adobe.com/2006/mxml](http://www.adobe.com/2006/mxml)” xmlns:All="\*" layout=“absolute” creationComplete=“startup();”\>

```
&lt;mx:Script&gt;
	&lt;![CDATA[
		var my_req:URLRequest = new URLRequest("test_xml.xml");
		var loader:URLLoader;
		
		public function startup():void {
			loader = new URLLoader(my_req);
			loader.addEventListener(Event.COMPLETE,eventhandler);
		}
		
		public function eventhandler(ev:Event):void {
			testtext.text = XML(loader.data).string;
		}
	]]&gt;
&lt;/mx:Script&gt;

&lt;mx:Text id="testtext" /&gt;

```

\</mx:Application\>
