Hi all, i’m trying to learn about clases, and i tried to make an easy XML loader, but i gotta a problem with the attributes that doen’t take the value i provide with the att variable. it shows me on the trace statement like undefined, and for example if i change the atrribute instead of being dynamic, to be static, it does work.
Any hint or help would be really appreciated
thanks in advance
class XMLS {
function XMLS(Path:String, textfield:TextField, att:String, n:Number) {
var miXML:XML = new XML();
miXML.ignoreWhite = true;
miXML.onLoad = function(success:Boolean) {
if (success) {
attributesLoader(miXML, textfield, att, n);
} else {
trace("error loading XML");
}
};
miXML.load(Path);
}
public static function attributesLoader(miXML, textfield, att, n) {
var main:Array = miXML.firstChild.childNodes;
var numNodes:Number = main.length;
for (var a:Number = 0; a<numNodes; a++) {
if (atributos != "0") {
trace(main[0].attributes.att);
} else {
trace("there's no attributes")
}
}
}
}