Hi there…I am busy working on a xml driven photo gallery where the number buttons for each picture are generated dynamically ie) 6 xml nodes…6 buttons generated labelled 1-6 and everything is working fine.
I want to have a thumbnail hover state appear when I roll over each of the buttons. I have a static thumbnail which loads in the thumb_path, however I cant seem to get this to work when you hover over the buttons…the **function menu() ** is what generates the buttons: Can anyone shed some light on what would be the best way to create a thumbnail preview for the buttons? I have attached a preview of the gallery as well.
Here is the code I have.
function loadXML(success) {
if (success) {
xmlNode = this.firstChild;
description_x = [];
description_y = [];
description_w = [];
picture_path = [];
thumb_path = [];
description = [];
web_address = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
description_x* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description_y* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
description_w* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
thumb_path* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
picture_path* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[5].firstChild.nodeValue;
web_address* = xmlNode.childNodes*.childNodes[6].firstChild.nodeValue;
}
delay_time = Number(this.firstChild.attributes.delay_time*1000);
stop_time = Number(this.firstChild.attributes.stop_time*1000);
bgColor = this.firstChild.attributes.bgColor;
BGcolor = new Color(background_mc);
BGcolor.setRGB(bgColor);
preloaderColor = this.firstChild.attributes.preloaderColor;
PRLcolor = new Color(preloader);
PRLcolor.setRGB(preloaderColor);
holder_mc._x = 78;
holder_mc._y = 35;
menu_visible = this.firstChild.attributes.menu_visible;
if (menu_visible == "no" || menu_visible == "NO") {
slideMenu._visible = false;
} else {
slideMenu._visible = true;
}
if (popOut_visible == "no" || popOut_visible == "NO") {
slideMenu._visible = false;
} else {
slideMenu._visible = true;
}
menu_axis = this.firstChild.attributes.menu_axis;
menu_x = Number(this.firstChild.attributes.menu_x);
menu_y = Number(this.firstChild.attributes.menu_y);
bannerBTN=this.firstChild.attributes.bannerBTN;
if (bannerBTN == "no" || bannerBTN == "NO") {
holder_mc.btn._visible = false;
} else {
holder_mc.btn._visible = true;
}
menu_spacer = Number(this.firstChild.attributes.menu_spacer);
slideMenu._x = menu_x;
slideMenu._y = menu_y;
menu();
slide();
} else {
holder_mc.description_txt.text = "LOADING.... ";
}
delete xmlData;
}
start_x = 0;
start_y = 0;
function slide() {
if (n == undefined || n == total) {
n = 0;
}
clearInterval(timeInterval);
menuColor(n);
buildSlideshow(n);
++n;
}
play_mc.onRelease = function() {
play_mc.gotoAndStop(1);
trace("start this thing up again");
_root.delay_time = 6000;
play_mc.enabled = false;
slide(n+1);
}
back_mc.onRelease = function() {
slide(n=n-2);
if(n == 0) {
slide(n+1);
delay_time = 6000;
}
}
back_mc.onRollOver = function() {
back_mc.gotoAndPlay("t1");
}
back_mc.onRollOut = function() {
back_mc.gotoAndStop("t0");
}
fwd_mc.onRelease = function() {
slide(n+1);
}
fwd_mc.onRollOver = function() {
fwd_mc.gotoAndPlay("t1");
}
fwd_mc.onRollOut = function() {
fwd_mc.gotoAndStop("t0");
}
function menu() {
start_x = 600 - (total*32)
back_mc._x = 683 - ((total)*32)
//trace(i)
//trace ("startx s " + start_x)
for (i=0; i<total; i++) {
slideMenu.attachMovie("menu_btn", "item"+i, i);
item = slideMenu["item"+i];
item.number_box.text = i+1;
if (menu_axis == "x" || menu_axis == "X") {
item._x = start_x;
}
if (menu_axis == "y" || menu_axis == "Y") {
item._y = start_y;
}
start_x += menu_spacer+item._width;
start_y += menu_spacer+item._height;
item.num = i;
item.onRelease = function() {
trace("stop the show");
play_mc.gotoAndStop("pause");
play_mc.enabled = true;
delay_time = 99999999990000;
clearInterval(stopInterval);
slide(n=this.num);
};
}
}
function buildSlideshow(i) {
holder_mc._alpha = 0;
holder_mc.description_txt._x = description_x*;
holder_mc.description_txt._y = description_y*;
holder_mc.description_txt._width = description_w*;
holder_mc.picture_mc.loadMovie(picture_path*);
popOut.loadlil_mc.loadMovie(thumb_path*);
holder_mc.description_txt.autoSize = "left";
holder_mc.description_txt.htmlText = description*;
holder_mc.btn._width = 641;
holder_mc.btn._height = 314;
holder_mc.btn.onRelease = function() {
getURL(web_address*, "_blank");
};
this.onEnterFrame = function() {
preloader._alpha = 100;
bLoaded = holder_mc.picture_mc.getBytesLoaded();
bTotal = holder_mc.picture_mc.getBytesTotal();
if (bLoaded<bTotal) {
holder_mc._alpha = 0;
preloader.loader_txt.htmlText = "LOADING "+ Math.round(bLoaded/bTotal*100)+"%";
} else if (bLoaded>=bTotal && bLoaded>100 && bTotal>100) {
preloader._alpha = 0;
if (holder_mc._alpha<100) {
preloader.loader_txt.htmlText = "";
holder_mc._alpha += 10;
}
if (holder_mc._alpha>=100) {
timeInterval = setInterval(slide, delay_time);
delete this.onEnterFrame;
}
}
};
if (holder_mc.description_txt.text == "" or holder_mc.description_txt.text == " ") {
holder_mc.back_color._alpha = 0;
} else {
holder_mc.back_color._alpha = 100;
}
holder_mc.back_color._x = holder_mc.description_txt._x;
holder_mc.back_color._y = holder_mc.description_txt._y;
holder_mc.back_color._width = holder_mc.description_txt._width;
holder_mc.back_color._height = holder_mc.description_txt._height;
}
function menuColor(n) {
for (i=0; i<total; i++) {
slideMenu["item"+i].gotoAndStop(1);
}
slideMenu["item"+n].gotoAndPlay("s1");
}
this.createEmptyMovieClip("slideMenu", this.getNextHighestDepth());
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("slideshow.xml");
Thanks for any assistance on this