PDA

View Full Version : XML Photogallery - one tiny problem



grahamwok
February 15th, 2007, 03:37 PM
Hi, I was wondering if someone out there could help me out with what might be a tiny problem... maybe.

I'd like my btn in flash to link to a URL. So i added it and then added to the actionscript the onrelease function for the button. I did a trace to see if it's targetting the link in the xml, and it is but it won't load the URL inside the xml. Please oh please... anyone?

Here is my xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image2>http://sumolab.co.uk/ymt_yorkvenues/images/shire.jpg</image2>
<link>http://www.grahamhowe.net</link>
</pic>
</images>

The actionscript:

delay = 3000;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image1 = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image1[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
link[i] = xmlNode.firstChild.firstChild.childNodes[1].nodeValue;
//trace (xmlNode.firstChild.childNodes[1].firstChild.nodeValue);
evening_btn.onRelease = function(){
getURL(link[0]);

}
}

I'd be very grateful if anyone could send some advise my way.

Thanks in advance

stringy
February 15th, 2007, 03:59 PM
Hi, I was wondering if someone out there could help me out with what might be a tiny problem... maybe.

I'd like my btn in flash to link to a URL. So i added it and then added to the actionscript the onrelease function for the button. I did a trace to see if it's targetting the link in the xml, and it is but it won't load the URL inside the xml. Please oh please... anyone?

Here is my xml:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
<pic>
<image2>http://sumolab.co.uk/ymt_yorkvenues/images/shire.jpg</image2>
<link>http://www.grahamhowe.net</link>
</pic>
</images>

The actionscript:

delay = 3000;
//-----------------------
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image1 = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {
image1[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
link[i] = xmlNode.firstChild.firstChild.childNodes[1].nodeValue;
//trace (xmlNode.firstChild.childNodes[1].firstChild.nodeValue);
evening_btn.onRelease = function(){
getURL(link[0]);

}
}

I'd be very grateful if anyone could send some advise my way.

Thanks in advance

try

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image1 = [];
link = [];
total = xmlNode.childNodes.length;
trace(total);
for (i=0; i<total; i++) {
image1[i] = xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;
link[i] = xmlNode.childNodes[i].childNodes[1].firstChild.nodeValue;
}
evening_btn.onRelease = function() {
getURL(link[0]);
};
}
}

grahamwok
February 16th, 2007, 04:55 AM
Thank you very mucho. I love you... well, maybe a pint if i ever saw you. Thanks again

stringy
February 16th, 2007, 09:40 AM
Thank you very mucho. I love you... well, maybe a pint if i ever saw you. Thanks again

no problem