flash (macromedia):
Please help. Just looking for the line of code that will display hyperlinks in
my flash photo slideshow from my XML document.
Here's my sample xml:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<images>
<pic>
<image>images/tiger.gif</image>
<headline>Tiger Kills Man</headline>
<thumbnail>images/tiger_thumbnail.gif</thumbnail>
<caption>Tiger killed man at 9:00pm.. </caption>
<preview>Crazy tiger killed man at 9:00pm. No witnesses. Click here for
more.</preview>
</pic>
And heres the first half of my .as file
Here is my as code (pretty much from tutorials here).
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
thumbnails = [];
caption = [];
preview = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
description[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
thumbnails[i] = xmlNode.childNodes[i].childNodes[2].firstChild.nodeValue;
caption[i] = xmlNode.childNodes[i].childNodes[3].firstChild.nodeValue;
preview[i] = xmlNode.childNodes[i].childNodes[4].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("pics.xml");
/////////////////////////////////////
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
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 += 10;
}
}
};
function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
caption_txt.text = caption[p];
preview_txt.text = preview[p];
picture_num();
}
}
}
function prevImage() {
if (p>0) {
p--;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
desc_txt.text = description[p];
caption_txt.text = caption[p];
preview_txt.text = preview[p];
picture_num();
}
}
function firstImage() {
if (loaded == filesize) {
picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
caption_txt.text = caption[0];
preview_txt.text = preview[0];
picture_num();
}
THANK YOU!