8 Replies Latest reply on Aug 30, 2010 12:49 AM by ida_raski

    stream error creating new xml

    ida_raski Level 1

      I have a local xml file which contains some properties used to connect to a server.

      This file is stored in the app-storage. But if this file doesn't exist yet, it needs to be created.

       

      At that moment I get following stream error (popped up by the method showAlert):

      Server.Error.Request – HTTP request error - Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream Error. URL: app:/Server.xml" errorID=2032]. URL: Server.xml

       

      And this is my code:

       

      public function loadSavedConfig():void{

      var settingsFile:File = File.userDirectory.resolvePath("app-storage:/Server.xml");

            var serviceData:HTTPService =  new HTTPService();

                             

            if (settingsFile.exists == false) {

                  serviceData.url = "Server.xml";

                  serviceData.addEventListener("result"function(event:ResultEvent):void {serverDataLoadedLocally(event.result);});

                  serviceData.addEventListener(FaultEvent.FAULT, showAlert);

                  serviceData.send();

            } else {

                  serviceData.url = settingsFile.url;

                  serviceData.addEventListener("result"function(event:ResultEvent):void {serverDataLoadedLocally(event.result);});

                  serviceData.send();

            }                      

      }

       

      Does anyone has an idea what I'm doing wrong?

      Thanks in advance.

       

      Regards.

      Kristof