# Help me with XML loading

**URL:** <https://forum.kirupa.com/t/help-me-with-xml-loading/252998>\
**Category:** flash\
**Created:** [February 26, 2008, 9:41am UTC](https://forum.kirupa.com/t/help-me-with-xml-loading/252998 "2008-02-26T09:41:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![corneliu9d](https://avatars.discourse-cdn.com/v4/letter/c/5e9695/32.png) [@corneliu9d](https://forum.kirupa.com/u/corneliu9d)\
**Post date:** [February 26, 2008, 9:41am UTC](https://forum.kirupa.com/t/help-me-with-xml-loading/252998/1 "2008-02-26T09:41:30Z")

</div>

This is probably a common issue, but I can’t figure it out. I have a class in which I load a XML file. I want to find a possibility to use the XML data so I can add some movieclips on the Stage.  
This is the class:

```auto
package GalleryPackage{
    import flash.net.*;
    import flash.events.*;
    import flash.display.Sprite;
    public class xmlParser extends Sprite{
        public var textData:TextLoader;
        var xmlObj:XML;
        public function xmlParser(url:String){
            textData=new TextLoader(url);
            textData.loader.addEventListener(Event.COMPLETE,completeHandler);
        }
        private function completeHandler(e:Event){
            xmlObj=new XML(textData.loader.data);
            trace(xmlObj);
        }
    }
}

```

This is the textLoader class:

```auto
package GalleryPackage{
    import flash.display.Sprite;
    import flash.net.*;
    import flash.events.*;
    public class TextLoader extends Sprite {
        public var entireText:String=new String();
        public var loader:URLLoader=new URLLoader();
        public function TextLoader(url:String) {
            var URLrequest:URLRequest=new URLRequest(url);
            loader.dataFormat=URLLoaderDataFormat.BINARY;
            loader.load(URLrequest);
            loader.addEventListener(Event.COMPLETE,completeHandler);
        }
        private function completeHandler(e:Event) {
            entireText=loader.data;
            trace(entireText);
        }
    }
}

```

My problem is that I don’t know (on the Stage) when the XML has finished loading, so I can use it. I have tried using EventDispatcher, but probably I’m too noob :|.  
Please give me an idea how to accomplish this.
