I have a slideshow that is working with one slight problem. When the photo comes up, it acts like a button, meaning it is clickable. the link doesn’t work of course, but I can’t figure out how to make it so it’s just an image. The following is the actionscript I’m using:
stop();
var total;
var p = 0;
//variables for slideshow
var slide = 1;
var delay_slide;
//this is the interval between the pics: 6 seconds
var interS = 3000;
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
link = [];
total = xmlNode.childNodes.length;
for (var i = 0; i<total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
link* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
loadPic(p);
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("slide.xml");
/////////////////////////////////////
function loadPic(p) {
picture.loadMovie(image[p]);
picture._alpha = 0;
var temp = this.createEmptyMovieClip("tem", 9978);
temp.onEnterFrame = function() {
var filesize = picture.getBytesTotal();
var loaded = picture.getBytesLoaded();
preloader._visible = true;
preloader.preload_bar._xscale = Math.round((loaded/filesize)*100);
if (picture._width) {
preloader._visible = false;
picture.fadeTo(100, 1.1);
desc_txt.text = description[p];
picture_num();
picture._alpha += 7;
if (picture._alpha>100) {
picture._alpha = 100;
picture.onRelease = function() {
getURL(link[p], "_blank");
};
//if the slideshow is running
if (slide) {
delay_slide = setInterval(showSlide, interS, total);
}
delete this.onEnterFrame;
}
}
};
}
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
}
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
previous_btn.onRelease();
} else if (Key.getCode() == Key.RIGHT) {
next_btn.onRelease();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
p>0 ? (p--, loadPic(p), slide=0) : null;
clearInterval(delay_slide);
stop_btn._visible = 0;
stop_btn.enabled = 0;
slide_btn._visible = 100;
slide_btn.enabled = 1;
};
next_btn.onRelease = function() {
p<total-1 ? (p++, loadPic(p), slide=0) : null;
clearInterval(delay_slide);
stop_btn._visible = 0;
stop_btn.enabled = 0;
slide_btn._visible = 100;
slide_btn.enabled = 1;
};
//function for the slideshow
function showSlide(total) {
//clear the interval (if there's a slideshow)
clearInterval(delay_slide);
p<total-1 ? (p++, loadPic(p), setButtons(p)) : (p=0, loadPic(p), setButtons(p));
}
slide_btn._visible = 0;
slide_btn.enabled = 0;
slide_btn.onRelease = function() {
this._visible = 0;
this.enabled = 0;
stop_btn._visible = 100;
stop_btn.enabled = 1;
slide = 1;
showSlide(total);
};
stop_btn.onRelease = function() {
clearInterval(delay_slide);
slide = 0;
this._visible = 0;
this.enabled = 0;
slide_btn._visible = 100;
slide_btn.enabled = 1;
};