utosky
March 26th, 2008, 09:35 PM
hello, i am have a slideshow fed by an XML file. I am trying to add external links to each of the main pictures. But I get site.com/undefined
Here is the AS:
MCXML = new XML();
MCXML.load("albums/photos1.xml");
MCXML.ignoreWhite = true;
MCXML.onLoad = function(succes) {
function Pic_Desc(n, u, g) {
this.name = n;
this.url = u;
this.go = g;
this.small = undefined;
}
if (succes) {
//extraction des images du fichier XML
var i = 0;
while (this.firstChild.childNodes[i] != undefined) {
_root.PIC[i] = new Pic_Desc(this.firstChild.childNodes[i].attributes.nom, this.firstChild.childNodes[i].attributes.url, this.firstChild.childNodes[i].attributes.go);
if (this.firstChild.childNodes[i].attributes.mignature != undefined) {
_root.PIC[i].small = this.firstChild.childNodes[i].attributes.mignature;
}
i++;
}
_root.MAX = i;
button_btn.onRelease = function() {
getURL(this.go, "_blank");
};
Here is an extract of the XML:
<photo nom="Love in New York" url="http://farm1.static.flickr.com/102/316119849_0001a45a58_o.jpg" mignature="http://farm1.static.flickr.com/102/316119849_0001a45a58_s.jpg" go="http://www.flickr.com/photos/angel_girl_x/928657526/in/set-72157604069725065/"/>
Can you please help me understand what's is wrong?
Thank you,
Marine
Here is the AS:
MCXML = new XML();
MCXML.load("albums/photos1.xml");
MCXML.ignoreWhite = true;
MCXML.onLoad = function(succes) {
function Pic_Desc(n, u, g) {
this.name = n;
this.url = u;
this.go = g;
this.small = undefined;
}
if (succes) {
//extraction des images du fichier XML
var i = 0;
while (this.firstChild.childNodes[i] != undefined) {
_root.PIC[i] = new Pic_Desc(this.firstChild.childNodes[i].attributes.nom, this.firstChild.childNodes[i].attributes.url, this.firstChild.childNodes[i].attributes.go);
if (this.firstChild.childNodes[i].attributes.mignature != undefined) {
_root.PIC[i].small = this.firstChild.childNodes[i].attributes.mignature;
}
i++;
}
_root.MAX = i;
button_btn.onRelease = function() {
getURL(this.go, "_blank");
};
Here is an extract of the XML:
<photo nom="Love in New York" url="http://farm1.static.flickr.com/102/316119849_0001a45a58_o.jpg" mignature="http://farm1.static.flickr.com/102/316119849_0001a45a58_s.jpg" go="http://www.flickr.com/photos/angel_girl_x/928657526/in/set-72157604069725065/"/>
Can you please help me understand what's is wrong?
Thank you,
Marine