First off, this is an incredible and invaluable site. Thank you to everyone that started it and continues to contribute to it.
I really didn’t want to have to post a new thread about this. I searched for an answer all day yesterday but could find no answers, though I did find a ton of other information that helped me on other problems.
Here is my problem:
I have followed all of the amazing tutorials and forum support to create a xml photo gallery with thumbs that I’m really happy with. My only problem is that my thumbs load into a grid in a random, sometimes backwards order. I want to load these thumbs through xml instead of an array and would really appreciate if someone could let me know if they see something I’m missing.
var xPos:Number = 0;
var yPos:Number = 0;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = ;
description = ;
thumbnails = ;
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = “file not loaded!”;
}
}
(blah, blah, blah…)
function thumbnails_fn(k) {
thumbnail_mc.createEmptyMovieClip(“t”+k, thumbnail_mc.getNextHighestDepth());
tlistener = new Object();
tlistener.onLoadInit = function(target_mc) {
target_mc._x = xPos;
target_mc._y = yPos;
xPos += target_mc._width+5;
if (xPos>=target_mc._width*6) {
xPos = 0;
yPos += target_mc._height+5;
}
target_mc.pictureValue = k;
if (xPos>(target_mc._width)*6) {
xPos = 0;
yPos += (target_mc._height);
}
};
(blah, blah, blah…)
image_mcl = new MovieClipLoader();
image_mcl.addListener(tlistener);
image_mcl.loadClip(thumbnails[k], "thumbnail_mc.t"+k);
}
I have read articles threads on using “onLoadComplete” to solve this problem, yet the information was not clear to me. I have also read articles where people recommended moving “thumbnails_fn(i);” and changing it to “thumbnails_fn(count);” and setting a value for the “(count)”. This only resulted in my grid displaying the image that corresponded to the value given (i.e. 0 = thumb01.jpg, 2 = thumb03.jpg)
Hopefully there is someone out there that can easily resolve this issue, and hopefully that resolution can be used by the other people that seem to be asking similar questions.
Thanks in advance.