# XML.onLoad event handling \[MX2004\]

**URL:** <https://forum.kirupa.com/t/xml-onload-event-handling-mx2004/101015>\
**Category:** Uncategorized\
**Created:** [February 4, 2004, 10:35pm UTC](https://forum.kirupa.com/t/xml-onload-event-handling-mx2004/101015 "2004-02-04T22:35:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonp](https://avatars.discourse-cdn.com/v4/letter/j/c77e96/32.png) [@jasonp](https://forum.kirupa.com/u/jasonp)\
**Post date:** [February 4, 2004, 10:35pm UTC](https://forum.kirupa.com/t/xml-onload-event-handling-mx2004/101015/1 "2004-02-04T22:35:34Z")

</div>

Hi. I appreciate the help!

I have a class with a XML object in it. In one of the class’ methods, I tell the XML object to load a document. Before I do that, I set up the onLoad event to call one of the class’ other methods. The problem is that in that handler function, I can’t seem to access any of my class’ data. If I try to use the “this” pointer, I’m getting the XML object not my class.

A simple example:

[AS]  
class MyClass  
{  
var theXML:XML;  
var someVariable:Number;

function MyClass()  
{  
theXML = new XML();  
theXML.onLoad = XMLLoadHandler;  
theXML.load( “testFile.xml” );  
}

function XMLLoadHandler(success)  
{  
// This function gets called when the XML is done parsing,  
// but I can’t access any of the data or methods in this class!!  
// What do I need to do?  
trace(someVariable); // does not exist  
}  
}  
[/AS]

Thanks!!
