Нет, не рабочий. Вот правильный:

Код:
my_xml = new XML()
my_xml.load("/xmlfiles/data.xml")
my_xml.onLoad=function(success) {
if(!success||this.status){
return this.customErrorHandler(this.status, success);
}
this.customParsingProcedure();
}
my_xml.customParsingProcedure = function () {
// custom actions here
}
my_xml.customErrorHandler = function (status, success){
trace("loaded: "+success+" valid: " + this.status);
// custom actions here
}
У меня есть класс AbstractXML, выполняющий те же функции. Если нужно выполнить парсинг, я просто наследуюсь от этого класса и описываю в нём метод prepareData, а чаще просто использую без наследования:

Код:
import mx.events.EventDispatcher;
/**
* @author Denis Kolyako
*/
class ru.etcs.data.AbstractXML extends XML {
private var __xml_url:String;
public var event:String = 'onXMLLoad';
public var errorEvent:String = 'onXMLLoadError';
public var idMap:Object;
public var dispatchEvent:Function;
public var addEventListener:Function;
public var removeEventListener:Function;
public function AbstractXML(xml_url:String) {
super("");
this.ignoreWhite = true;
EventDispatcher.initialize(this);
this.__xml_url = xml_url;
this.load(this.__xml_url);
}
private function onLoad(ok:Boolean):Void {
if (!ok || !this.loaded || this.status || this.getBytesTotal()<30) {
trace('XML loaded: '+this.loaded+', valid: '+this.status);
this.dispatchEvent({type:this.errorEvent});
return;
}
this.prepareData();
this.dispatchEvent({type:this.event});
}
private function prepareData():Void {
// For override
}
}