That was supposed to be my first preloader dealing with an XML file and external jpgs … searched the forum, found something that looked/sounded like it would work, tried to adapt it to my particular situation and … (surprise!) … it doesn’t work. Let me add at this point that I’d consider myself a “very casual” ActionScripter (if there is such a thing), meaning that most of the time, I try to learn as I go along, without any real background knowledge. Here’s my situation - methinks it’s rather straightforward:
SWF file (project.swf), XML file (config.xml) and a bunch of jpgs all in the same directory - nothing exotic so far. Here’s the AS I (try to) use in my SWF file to load the xml and the imgs therein:
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.load("config.xml");
this.onEnterFrame = function() {
bL = xmlData.getBytesLoaded();
bT = xmlData.getBytesTotal();
bP = bL/bT;
trace(bT+" : "+bL);
if (bT == undefined) {
_root.preloader.preloader_mc_txt.text = "connecting ...";
} else {
lno_txt.text = "loading ... "+bT+" total (bytes) "+bL+" loaded (bytes)";
}
if (bL == bT) {
lno_txt.text = "";
delete this.onEnterFrame;
} else {
trace("fudgepickles ...");
}
};
xmlData.onLoad = function(success) {
if (success) {
trace("w00t!!");
trace(this);
// project name
project = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.prjtitle.prjname.text = project;
// 01 screen + title
name01 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.scrnames.n01.scrn01.text = name01;
screen01 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
_root.container.imgslider.imgc01.loadMovie(screen01);
// 02 screen + title
name02 = this.firstChild.childNodes[2].childNodes[0].firstChild.nodeValue;
_root.scrnames.n02.scrn02.text = name02;
screen02 = this.firstChild.childNodes[2].childNodes[1].firstChild.nodeValue;
_root.container.imgslider.imgc02.loadMovie(screen02);
// 03 screen + title
name03 = this.firstChild.childNodes[3].childNodes[0].firstChild.nodeValue;
_root.scrnames.n03.scrn03.text = name03;
screen03 = this.firstChild.childNodes[3].childNodes[1].firstChild.nodeValue;
_root.container.imgslider.imgc03.loadMovie(screen03);
// more of the same comes after this line ...
} else {
trace("son of a b!tch ...");
}
};
The script gets to “[color=Blue]connecting …[/color]” and then traces “fudgpickles” until the end of time (when run locally - running from my server it loads the imgs without ever displaying the “[color=Blue]loading …[/color]” part) and, to be brutally honest, I don’t have the slightest clue as to why that is …
:x
Any help, tips, slaps on the forehead (mine, that is) would be much appreciated.