Hello all
I have set up an xml thumbnail gallery using some of the great tuts on this site (I’m a designer so this dev stuff tends to get a little confusing). Basic setup is quite simple:
xml holds titles, thumb urls and details
set up thumbs as a grid system, so they’re loading in as columns, all of which is working great.
I have run into a bit of a brick wall though, and that is how to get the thumbs to sequentially load in, instead of random as they currently are.
...
function GeneratePortfolio(portfolio_xml) {
var portfolioTitle = portfolio_xml.childNodes[0].attributes.title;
var rootUrl = portfolio_xml.childNodes[0].childNodes[0].attributes.rooturl;
var nodes = portfolio_xml.childNodes[0].childNodes[0].childNodes;
var total = nodes.length;
for ( var i=0; i < nodes.length; i++ ){
var imgId = nodes*.attributes.id;
var imgTitle = nodes*.attributes.title;
var imgDesc = nodes*.attributes.desc;
var currentThumb_mc = menu_mc.attachMovie("thumbnail_mc", "thumbnail_mc"+i, i);
currentThumb_mc._x = (i%columns)*thumb_hspacing;
currentThumb_mc._y = Math.floor(i/columns)*thumb_vspacing;
currentThumb_mc.createEmptyMovieClip("thumb_container", 0);
currentThumb_mc.thumb.loadMovie( rootUrl + imgId + "a.jpg?randomnum="+(new Date()).getTime());
currentThumb_mc.title.text = imgTitle;
trace(imgTitle);
currentThumb_mc.image = rootUrl + imgId + "b.jpg?randomnum="+(new Date()).getTime();
currentThumb_mc.description = imgDesc;
currentThumb_mc.slideCounter = i;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver=function () {
this.thumb_bg.alphaTo(0, .5, "linear");
this.thumb_frame.alphaTo(100, .5, "linear");
};
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut=function () {
this.thumb_bg.alphaTo(100, .5, "linear");
this.thumb_frame.alphaTo(2, .5, "linear");
};
currentThumb_mc.onRelease = function() {
_root.containerMC._visible=true;
_root.containerMC.picHolder_mc.loadMovie(this.image+"?randomnum="+(new Date()).getTime());
_root.containerMC.caption.text=this.description;
this.thumb_bg.alphaTo(0, .5, "linear");
this.thumb_frame.alphaTo(100, .5, "linear");
slideCount = this.slideCounter;
};
}
}
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success) {
if (success) {
GeneratePortfolio(this);
} else {
trace("Error loading XML file");
}
};
portfolio_xml.load("jacob.xml");
...
All fairly standard stuff, but I can’t think how to go about getting the thumbs to load in sequentially. Any help on this would be much appreciated.
Thx in advance
Lee