# Need help with xml

**URL:** <https://forum.kirupa.com/t/need-help-with-xml/228051>\
**Category:** programming\
**Created:** [June 5, 2007, 1:52am UTC](https://forum.kirupa.com/t/need-help-with-xml/228051 "2007-06-05T01:52:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sasxa](https://avatars.discourse-cdn.com/v4/letter/s/da6949/32.png) [@sasxa](https://forum.kirupa.com/u/sasxa)\
**Post date:** [June 5, 2007, 1:52am UTC](https://forum.kirupa.com/t/need-help-with-xml/228051/1 "2007-06-05T01:52:54Z")

</div>

What’s wrong with this code? Why is my xml variable **null** in start() function?

Tnx, Sasxa

```auto

package {
    import flash.events.*;
    import flash.net.URLLoader;
    import flash.net.URLRequest;

    public class MyClass {
        private var xml:XML;

        public function MyClass() {

            var xmlLoader:URLLoader = new URLLoader();
            xmlLoader.addEventListener(Event.COMPLETE, loadXML);
            xmlLoader.load(new URLRequest("test.xml"));

            start();
        }

        private function loadXML(event:Event):void {
            xml = new XML(event.target.data);
            trace(xml); // works here...
         }
        
        private function start():void {
             trace(xml); // null here???
        }
    }
}

```
