I create a slideshow based on kirupa’s slideshow tutorial with a modification in xml structure, a few tweaks in actionscript and the onRelease function. I seem can’t get the current image to become an active link. Basically I’m trying to make the image/movie holder as an active link that the users can click on to go to different page. I’m xml and advanced as newbie, so I’m still grippin’ with 'em. Figure I could use some of your help/suggestion how to get the function to work right way…
xml:
<slideshow>
<image imageURL="images/tna.jpg" linkURL="http://www.espn.com" />
<image imageURL="images/donkey.jpg" linkURL="http://www.yahoo.com" />
<image imageURL="images/freak.jpg" linkURL="http://www.google.com" />
</slideshow>
actionscript:
delay = 5000;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild.childNodes;
imageURL = [];
linkURL = [];
total = xmlNode.length;
for (i=0; i<total; i++) {
imageURL* = xmlNode*.attributes.imageURL;
linkURL* = xmlNode*.attributes.linkURL;
}
firstImage();
} else {
trace('problem');
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
p = 0;
this.onEnterFrame = function() {
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.preload_bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (picture._alpha<100) {
picture._alpha += 5;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(imageURL[p], 1);
this.picture.onRelease = function () {
getURL(this.linkURL[0]);};
slideshow();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(imageURL[p], 1);
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(imageURL[0], 1);
this.picture.onRelease = function () {
getURL(this.linkURL[0]);};
slideshow();
}
}
function slideshow() {
myInterval = setInterval(pause_slideshow, delay);
function pause_slideshow() {
clearInterval(myInterval);
if (p == (total-1)) {
p = 0;
firstImage();
} else {
nextImage();
}
}
}
Happy New Year!
Jace