XML onLoad function

Somebody knows how to include in a class the implementation of the onLoad function of the XML class. I have something like:

class theClass
{
private var output : XML;

private  var input : String;

function theClass( )
{
     output = new XML( );
     output.onLoad = myOnLoad;
     output.load( );
}

function myOnLoad
{
     input = output.firstChild.childNodes[0].attributes.n;
}

}

BUT!! … it doesn’t work. Some ideas???