# XML in custom class?

**URL:** https://forum.kirupa.com/t/xml-in-custom-class/235707
**Category:** flash
**Created:** [August 14, 2007, 5:08am UTC](https://forum.kirupa.com/t/xml-in-custom-class/235707 "2007-08-14T05:08:18Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![wilbur\_b7](https://avatars.discourse-cdn.com/v4/letter/w/4af34b/32.png) [@wilbur\_b7](https://forum.kirupa.com/u/wilbur_b7)
#### Post date: [August 14, 2007, 5:08am UTC](https://forum.kirupa.com/t/xml-in-custom-class/235707/1 "2007-08-14T05:08:18Z")

</div>

why wouldn’t this work as an AS2.0 class? the ‘myXml’ value always comes up undefined. i’ve established that it is loading the xml file and i’ve tried local and online xml files and i’m just stuck… i’m new to class building.

thanks for your help.

the as file…

```auto

class com.news.newsXML 
{
    //
    private var myXml:XML;
    
    //
    public function newsXML()
    {
        init();
    }
    //
    private function init():Void
    {
        trace("init();");
        myXml = new XML();
        myXml.ignoreWhite = true;
        myXml.onLoad = parseNews;
        myXml.load("any.xml");
    }
    //
    private function parseNews():Void
    {
        trace("Function: parseNews();");
        trace("myXml == " + myXml);
    }
}

```

in the fla…

```auto
import com.news.newsXML;
var newsObj:newsXML = new newsXML();

```
