Hi,
As stated the other day, XML is something I ignored until recently, now that I see how useful it is I shall be using it all the time.
I made my first XML gallery yesterday, and now I’m just polishing it up.
I have a problem though. I’m loading thumbnails into holders in the XML onLoad loop, and I am also assigning the holder a preloader.
Now this worked perfectly in another non XML loop, with the exact same preloader function etc.
In the XML loop it doesn’t. When the preloader is assigned to the holder, it hasn’t yet registered that a JPG is being loaded into it, it is preloading what it thinks is just an empty MC, and thus sets percentloaded to 100, and the preloader is void.
Now this can be fixed fairly easily by making another loop a few frames down the timeline, to give it time to register that something is being loaded into the holder.
However, I don’t want to do this, it’s stupid, I want to keep things nice and neat all in 1 loop.
For you XML savvy kirupians, what else can I do? I’m a bit confused because I thought the XML onLoad function was to prevent hiccups like this.
Any idea of what I can do other than having to create another loop to load the thumbs a few frames down?
Here is the XML loop…
xml.onLoad = function(loaded) {
if (loaded) {
total = this.firstChild.childNodes;
for (var i = 0; i<total.length; i++) {
description.push(total*.firstChild.firstChild);
thumbs.push(total*.firstChild.nextSibling.firstChild);
bigpics.push(total*.firstChild.nextSibling.nextSibling.firstChild);
if (i%4 == 0) {
b = 0;
c++;
}
initObj = {_x:h_pos+b*h_spacing, _y:v_pos+c*v_spacing};
bob = attachMovie("thumb", "thumb"+i, i, initObj);
thumbholders.push(bob);
bob.holder.loadMovie("thumbs/"+thumbs*);
bob.id = i;
thumbloader(bob);
bob.onRollOver = function() {
testbox.text = this.id;
this.gotoAndStop(2);
};
bob.onRollOut = function() {
this.gotoAndStop(1);
};
bob.onRelease = function() {
hidethumbs();
bigholder.holder.loadMovie("thumbs/"+bigpics[this.id]);
bigloader(bigholder);
};
b++;
}
}
};
xml.load("illustration.xml");
By the way, how do some of you paste the code with the AS colourcoding in tact? Surely you don’t do this manually?
Cheers,
Joe