Hello guys, long time no see…
function chargeXML() {
joueurs_xml = new XML();
loader = new LoadVars();
joueurs_xml.ignoreWhite = true;
joueurs_xml.onLoad = function(success) {
if (success) {
trace("xml loaded successfully.");
root = joueurs_xml.firstChild;
initJoueurs();
} else {
trace("xml failed to load.");
}
};
joueurs_xml.load("http://url.xml"); //fake xml address, can't put functionnal addy.
_root.onEnterFrame = function() {
preload = joueurs_xml.getBytesLoaded();
total = joueurs_xml.getBytesTotal();
percent = (preload/total)*100;
trace(total);
trace(percent);
if (percent>=100) {
delete _root.onEnterFrame;
}
};
}
chargeXML();
I get “undefined” for my var total and thus NaN for percent. What’s going on???