# Oop as2 - component - problem with referring class to itself

**URL:** <https://forum.kirupa.com/t/oop-as2-component-problem-with-referring-class-to-itself/232899>\
**Category:** Uncategorized\
**Created:** [July 18, 2007, 4:48pm UTC](https://forum.kirupa.com/t/oop-as2-component-problem-with-referring-class-to-itself/232899 "2007-07-18T16:48:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jansensan](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jansensan/32/3362_2.png) [@jansensan](https://forum.kirupa.com/u/jansensan)\
**Post date:** [July 18, 2007, 4:48pm UTC](https://forum.kirupa.com/t/oop-as2-component-problem-with-referring-class-to-itself/232899/1 "2007-07-18T16:48:22Z")

</div>

hello, im currently creating a component which calls on an xml file. i want a function from the class to be called once the xml is loaded, but i cant seem to target the function.

```auto
class className {
    
    // variable
    var inputXML:XML;

    // constructor    
    public function className () {
        this.init ();
    }
    
    // initialization
    private function init () {
        this.inputXML = new XML ();
        this.inputXML.ignoreWhite = true;
        this.inputXML.load ("xmlfile.xml");
        this.inputXML.onLoad = function (success) {
            if (success){
                this._parent.setContent (this);
            }
        }
    }

    // functions
    private function setContent (xml:XML) {
        trace (xml);
    }
}

```

logic suggests that since [FONT=Courier New]inputXML [/FONT]belongs to the class, it’s parent should be the class. however, with the onload, it seems that it cannot reach its parent. i even tried without relating to the class ([FONT=Courier New]setContent (this)[/FONT] instead of [FONT=Courier New]this.\_parent.setContent (this)[/FONT]) and still doesnt work

what should i look for?
