Targeting A Node In Xml

how can a target a specific node here?

Page 1 of 1

0 Replies - 1569 Views - Last Post: 26 January 2004 - 09:35 AM

#1 daveglanz  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 31-July 02

Targeting A Node In Xml

Posted 26 January 2004 - 09:35 AM

So I'm still working on this interface-the problem is targeting a specific node.

the "select" function in this script is not working, and I cant' figure out why:

[AS]images_xml = new XML();
images_xml.onload = startImages;
images_xml.load("xml/images.xml");
images_xml.ignoreWhite = true;

function startImages(success) {
if (success == true) {
rootNode = images_xml.firstChild.firstChild;
totalImages = rootNode.childNodes.length;
firstImageNode = rootNode.firstChild;
lastImageNode = rootNode.lastChild;
currentImageNode = firstImageNode;
currentIndex = 1;
updateImage(firstImageNode);
}
}
//New image:
function updateImage(newImageNode) {
imagePath = newImageNode.attributes.jpegURL;
imageText = newImageNode.firstChild.nodeValue;
contentMc.loadMovie(imagePath);
}

_global.select = function(whichImageNode) {
whichNode = currentImageNode.nextSibling-1;
if(whichImageNode = null) {
currentImageNode = currentImageNode;
currentIndex = whichImageNode;
updateImage(currentImageNode);
}
currentIndex = whichImageNode;
updateImage(whichImageNode);
currentImageNode = whichImageNode;
}

_global.next = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
currentImageNode = firstImageNode;
currentIndex = 1;
updateImage(currentImageNode);
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
//

_global.prev = function() {
previousImageNode = currentImageNode.previousSibling;
if (previousImageNode == null) {
//break;
currentImageNode = lastImageNode;
currentIndex = totalImages;
updateImage(currentImageNode);
} else {
currentIndex--;
currentImageNode = previousImageNode;
updateImage(previousImageNode);
}
};

/*code for BUTTONs*****/
nextBtn.onRelease = function() {
next();
};
prevBtn.onRelease = function() {
prev();
};

buttons1.onPress = function() {
select(1);
};
[/AS]

any ideas?

thanks,
-DG

Is This A Good Question/Topic? 0
  • +

Page 1 of 1