2 Replies Latest reply on Oct 29, 2006 9:36 PM by Leon.cc

    how can i read a xml file in code?

      i don't want use tag.(<mx:HTTPService />)
      please give me an example.
      thanks.
        • 1. Re: how can i read a xml file in code?
          peterent Level 2
          You have two choices with XML - either embed the XML into your SWF or load it dynamically. If you want to embed the XML into the SWF, then use <mx:XML source="somefile.xml" /> - but bear in mind this will read the XML file when the SWF is compiled, not when it is run. It will also increase the size of the SWF by the size of the XML document you embed.

          If you still want to dynamically load the XML but don't want to use HTTPService, you can use URLLoader (I believe it is flash.net.URLLoader).

          Once you've either embeded the XML or loaded it, you can use e4x syntax to access the content of the XML document.
          • 2. Re: how can i read a xml file in code?
            Level 1
            i had resolved this problem use URLRequest and URLLoader.
            thanks,peterent .