Good morning to you all (well at lest it’s morning where I am).
I’m fiddling about with a few things, basically just trying to learn how things work, but, again, I’m stuck.
What I’m trying to do is load a bunch of thumbnails from an XML-file and just display them following each other on a single row at the press of a button.
The XML loads just fine and I’ve managed to display single thumbnails by loading them in to existing movie clips, so no problem there either.
It’s when I’m trying to automate the process that i get stuck.
When the button is pressed I create a new movie clip for each thumbnail, place it in an array, place it on the stage and then load the corresponding thumbnail to it. Or at least, that’s what I’m trying to do.
I’d really appreaciate if some one would take a quick look at the code to try to see what I can’t seem to see is wrong.
I’m sure there’s better ways to do what I’m trying to do, feel free to fill me in on that as well if you want to.
Here’s the code:
[FONT=Courier New]function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
total = xmlNode.childNodes.length;
thumbs = [];
for (i=0; i<total; i++) {
thumbs* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
}
} else {
trace("file not loaded!");
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("thumbs.xml");
btn.onRelease = function() {
x = 0;
y = 300;
holder = [];
trace("btn pressed");
for (i = 0; i<thumbs.length; i++) {
trace("loop " + i);
trace(thumbs*);
this.createEmptyMovieClip("pic_holder" + i, i)
holder* = "pic_holder" + i;
this[holder*]._x = x;
this[holder*]._y = y;
this[holder*].loadMovie(thumbs*);
x = x + 140;
trace("holder " + i + " = " + holder*);
}
}[/FONT]
All and any help is welcome