title: AIR: Load local xml files outside the application folder
body: <p>I'm building an AIR application which will be used to edit slideshows for another app (also built by me, but not in AIR). The slideshows and other data are defined in several xml files which are in the other application's program folder. When trying to load these into my AIR app I get the following error: </p>
  
  <pre><code>fault(mx.messaging.messages::ErrorMessage)#0
    body = ""
    clientId = "DirectHTTPChannel0"
    correlationId = "D67CFDDA-2A2E-9D8B-21DE-7D9FB4B72167"
    destination = ""
    extendedData = (null)
    faultCode = "Server.Error.Request"
    faultDetail = "Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: app:/Users/path/to/folder/languages.xml" errorID=2032]. URL: /Users/path/to/folder/languages.xml"
    faultString = "HTTP request error"
    headers = (Object)#1
      DSStatusCode = 0
    messageId = "F54EACC8-22F3-3718-9106-7D9FB4E0649C"
    rootCause = (flash.events::IOErrorEvent)#2
      bubbles = false
      cancelable = false
      currentTarget = (flash.net::URLLoader)#3
        bytesLoaded = 0
        bytesTotal = 0
        data = ""
        dataFormat = "text"
    errorID = 2032
    eventPhase = 2
    target = (flash.net::URLLoader)#3
    text = "Error #2032: Stream Error. URL:    app:/Users/path/to/folder/languages.xml"
    type = "ioError"
  timestamp = 0
  timeToLive = 0
  </code></pre>
  
  <p>This is how I've coded it:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009" 
                     xmlns:s="library://ns.adobe.com/flex/spark" 
                     xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="windowedapplication1_creationCompleteHandler(event)"&gt;
  &lt;fx:Script&gt;
      &lt;![CDATA[
          import mx.events.FlexEvent;
          import mx.rpc.events.FaultEvent;
          import mx.rpc.events.ResultEvent;
  
          protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
          {
              this.languages.addEventListener(FaultEvent.FAULT, this.faultHandler);
              this.languages.addEventListener(ResultEvent.RESULT, resultHandler);
  
              this.languages.send();
          }
  
          private function faultHandler(event:FaultEvent):void
          {
              trace("fault" + event.message);
          }
  
          private function resultHandler(event:ResultEvent):void
          {
              trace("success" + event.result);
          }
  
      ]]&gt;
  &lt;/fx:Script&gt;
  &lt;fx:Declarations&gt;
      &lt;!-- Place non-visual elements (e.g., services, value objects) here --&gt;
      &lt;s:HTTPService id="languages" url="/Users/path/to/folder/languages.xml"/&gt;
  &lt;/fx:Declarations&gt;
  &lt;/s:WindowedApplication&gt;
  </code></pre>
  
  <p>How can I read from these files? The app will have no need to communicate with anything but the local files.</p>
  
  <p>Thanks to J_A_X's answer, I changed my creationCompleteHandler to:</p>
  
  <pre><code>var file:File = new File("/Users/path/to/folder/languages.xml");
  
  var fs:FileStream = new FileStream();
  fs.open(file, FileMode.READ);
  var text:String = fs.readUTFBytes(file.size);
  trace(text);
  </code></pre>
  
  <p>which worked like a charm.</p>