Hi everybody,
i’m using Sephiroth XMLObject to parse Xml and it works nice (handling actions inside the Xml Onload event), but i would like to cut shorter coding writing a class calling Xml and XMLObject, it’s possible?. This is an attempt but it doesn’t work, or better, Xml file is parsed correctly but is not available, any ideas?. In attacment the zipped code too, thanks.
This is the class:
import mx.utils.Delegate;
import XMLObject;
class XMLLoader {
private var xmlFileName:String;
private var x:XML;
public var xmlObject:Object;
function XMLLoader(sxmlFileName:String) {
xmlFileName = sxmlFileName;
init();
}
private function init() {
x = new XML();
x.ignoreWhite = true;
x.load(xmlFileName);
x.onLoad = Delegate.create(this, parse);
}
private function parse() {
var tempObject = new XMLObject();
xmlObject = tempObject.parseXML(x);
}
}
and this is fla action:
loadXmlMenu();
function loadXmlMenu() {
myXml = new XMLLoader("test.xml");
myArray = myXml.xmlObject.HomeMenu.Item;
trace(myArray);
}