Hello,
I have a cool xml gallery designed by Scotty. I was wondering what actionscript could I use to add a gray border around each thumbnail and whenever the user rolls over the thumbnail, the border turns to white? Has anyone done this sort of thing before with an XML gallery? :stare:
This is the code:
var thumb_spacing = 50;
var vertical_spacing = 61;
var columns = 3;
var index = 0;
var currentLength;
//set pop-up's visibility to false
window._visible = 0;
var description_lv = new LoadVars();
description_lv.onData = function(raw_text) {
description_txt.text = raw_text;
};
function GeneratePortfolio(portfolio_xml, t) {
//make a new array in mc window
window.pArray = new Array();
for (var i = 0; i<currentLength; i++) {
menu_mc.box["thumbnail_mc"+i].removeMovieClip();
}
var portfolioPictures = portfolio_xml.childNodes;
currentLength = portfolioPictures.length;
for (var i = 0; i<portfolioPictures.length; i++) {
var currentPicture = portfolioPictures*;
var currentThumb_mc = menu_mc.box.createEmptyMovieClip("thumbnail_mc"+i, i);
currentThumb_mc._x = 5+(i%columns)*thumb_spacing;
currentThumb_mc._y = 5+Math.floor(i/columns)*thumb_spacing;
currentThumb_mc.createEmptyMovieClip("thumb_container", 0);
currentThumb_mc.thumb_container.loadMovie(currentPicture.attributes.thumb);
currentThumb_mc.title = currentPicture.attributes.title;
currentThumb_mc.image = currentPicture.attributes.image;
currentThumb_mc.description = currentPicture.attributes.description;
//fill the array in mc window with the pictures
window.pArray.push(currentPicture.attributes.image);
//give each thumb it's own id variable
currentThumb_mc.id = i;
currentThumb_mc.onRollOver = currentThumb_mc.onDragOver=function () {
info_txt.text = this.title;
};
currentThumb_mc.onRollOut = currentThumb_mc.onDragOut=function () {
info_txt.text = "";
};
currentThumb_mc.onRelease = function() {
//make the pop-up visible
window._visible = 1;
//set the text for the pop-up
window.title.text = this.title;
//path has changed here
window.loadPic(this.image);
//set the variable cur in mc window to the current picture
window.cur = this.id;
//call function in mc window for setting the next and prev buttons +info text (see there)
window.setPrefPop(this.id);
description_lv.load(this.description);
};
}
setPortfolioNr(t);
delay = setInterval(setScroller, 500);
}
function choosePortfolio(index) {
//set the popup invisble when choosing a new gallery
window._visible=0;
var portfolio_xml = new XML();
portfolio_xml.ignoreWhite = true;
portfolio_xml.onLoad = function(success) {
if (success) {
var gallery = this.firstChild.childNodes[index];
galleryInfo.text = this.firstChild.childNodes[index].attributes.title;
var totalGalleries = this.firstChild.childNodes.length;
GeneratePortfolio(gallery, totalGalleries);
} else {
trace("Error loading XML file");
}
};
portfolio_xml.load("portfolio.xml");
}
function setPortfolioNr(t) {
back_btn.onRelease = function() {
index>0 ? index-- : index=t-1;
choosePortfolio(index);
};
fwd_btn.onRelease = function() {
index<t-1 ? index++ : index=0;
choosePortfolio(index);
};
}
function setScroller() {
clearInterval(delay);
if (menu_mc.box._height<menu_mc.mask._height) {
menu_mc.slide._visible = menu_mc.dragger._visible=0;
menu_mc.up_btn._visible = menu_mc.down_btn._visible=0;
menu_mc.vis = 0;
} else {
menu_mc.slide._visible = menu_mc.dragger._visible=1;
menu_mc.up_btn._visible = menu_mc.down_btn._visible=1;
menu_mc.dragger._y = 38;
menu_mc.vis = 1;
}
}
choosePortFolio(0);