function loadXML(success) {
if (success) {
xmlNode = this.firstChild;
description_x = [];
description_y = [];
description_w = [];
picture_path = [];
description = [];
web_address = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
description_x[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description_y[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
description_w[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
picture_path[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
web_address[i] = xmlNode.childNodes[i].childNodes[5].firstChild.nodeValue;
}
delay_time = Number(this.firstChild.attributes.delay_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 = 0;
holder_mc._y = 0;
menu_visible = this.firstChild.attributes.menu_visible;
if (menu_visible == "no" || menu_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 = "Cargando... ";
}
delete xmlData;
}
start_x = 0;
start_y = 0;
function slide() {
if (n == undefined || n == total) {
n = 0;
}
clearInterval(timeInterval);
menuColor(n);
buildSlideshow(n);
++n;
}
function menu() {
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() {
clearInterval(timeInterval);
slide(n=this.num);
};
}
}
function buildSlideshow(i) {
holder_mc._alpha = 0;
holder_mc.description_txt._x = description_x[i];
holder_mc.description_txt._y = description_y[i];
holder_mc.description_txt._width = description_w[i];
holder_mc.picture_mc.loadMovie(picture_path[i]);
holder_mc.description_txt.autoSize = "left";
holder_mc.description_txt.htmlText = description[i];
holder_mc.btn._width = 475;
holder_mc.btn._height = 260;
holder_mc.btn.onRelease = function() {
getURL(web_address[i], "_self");
};
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 = "Cargando "+ 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");