# XML problems

**URL:** <https://forum.kirupa.com/t/xml-problems/181987>\
**Category:** Uncategorized\
**Created:** [March 14, 2006, 7:00pm UTC](https://forum.kirupa.com/t/xml-problems/181987 "2006-03-14T19:00:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kodzoman](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kodzoman/32/2241_2.png) [@kodzoman](https://forum.kirupa.com/u/kodzoman)\
**Post date:** [March 14, 2006, 7:00pm UTC](https://forum.kirupa.com/t/xml-problems/181987/1 "2006-03-14T19:00:22Z")

</div>

Hi. I am having problems with XML.

I have this code which should read the XML

```auto

    snowflakes = 1;
    function loadXML(loaded) {
        if (loaded) {
            snowflakes = this.firstChild.childNodes.length;
        } else {
              trace("file not loaded!");
        }
    }
    xmlData = new XML();
    xmlData.ignoreWhite = true;
    xmlData.onLoad = loadXML;
    xmlData.load("avatars.xml");
    
   // Read number of nodes into text
   _level0.atext.text = snowflakes

```

What I would like to do is to use ANYTHING from XML 🙂 I get the this.firstChild.childNodes.length value out, but i can’t seem to be able to use it outside of the function loadXML ?? The same is with any other value read from XML. Although i defined the variable outside the function, it doesn’t want to override it.

Any hints please. Thanks for your help.
