XML object onLoad scope problem

Hi All,

I’ve got a very frustrating scope issue here, probably quite simple, but it’s got me stumped.

I have a class which loads up some XML into an XML object, on loading the XML I want to fire a function in the class. Here is my code:


class classes.availability extends MovieClip {
    var my_xml:XML;
    var feedURL:String;
    
    private function init(){
        trace("Initialising office availability");
        feedURL = "http://addressofmyxmlhere.xml";
        my_xml = new XML();
        my_xml.onLoad = function(success){
            trace("loaded XML");
            processXML(this);
        };
        my_xml.ignoreWhite = true;
        my_xml.load(feedURL);
    }

    public function processXML(xml){
        trace("processing XML");
    }
}

I’m obviously doing something wrong because processXML is not happening. I have tried calling _root.instance.processXML(this) in the onLoad function, and that works, but I can’t use _root because I don’t necessarily know where this is going to be used.

Any thoughts?

Many thanks
Kevin