BuzO
04.06.2007, 15:00
Помогите дописать actionscript, я недавно работаю с XML, поэтому возникают проблемки с кодом, мне нужно сделать всего переход к следующему Child в xml.
Вот так выглядит мой код:
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("anons.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
currentSlideNode = rootNode.firstChild;
do {
trace("currentNode:"+currentSlideNode);
currentIndex = 1;
updateSlide(currentSlideNode);
}while(null != (currentSlideNode = currentNode.nextSibling))
}
}
//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
currentNode=newSlideNode.firstChild;
do {
if(currentNode.LocalName == 'image'){
imagePath = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'url') {
url = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'title') {
slideText = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'description') {
description = currentNode.firstChild.nodeValue;
}
}while(null != (currentNode=currentNode.nextSibling));
//imagePath = newSlideNode.attributes.jpegURL;
trace("imagePath:"+imagePath);
//slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
Почему он не переходит к следующему Child я не понимаю.. + нужно сделать: если показывается последний Child, тогда начинался снова первый... помогите плиз...
Вот так выглядит мой код:
slides_xml = new XML();
slides_xml.onLoad = startSlideShow;
slides_xml.load("anons.xml");
slides_xml.ignoreWhite = true;
//
// Show the first slide and intialize variables
function startSlideShow(success) {
if (success == true) {
rootNode = slides_xml.firstChild;
totalSlides = rootNode.childNodes.length;
currentSlideNode = rootNode.firstChild;
do {
trace("currentNode:"+currentSlideNode);
currentIndex = 1;
updateSlide(currentSlideNode);
}while(null != (currentSlideNode = currentNode.nextSibling))
}
}
//
// Updates the current slide with new image and text
function updateSlide(newSlideNode) {
currentNode=newSlideNode.firstChild;
do {
if(currentNode.LocalName == 'image'){
imagePath = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'url') {
url = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'title') {
slideText = currentNode.firstChild.nodeValue;
}else if(currentNode.LocalName == 'description') {
description = currentNode.firstChild.nodeValue;
}
}while(null != (currentNode=currentNode.nextSibling));
//imagePath = newSlideNode.attributes.jpegURL;
trace("imagePath:"+imagePath);
//slideText = newSlideNode.firstChild.nodeValue;
loadMovie(imagePath, targetClip);
}
Почему он не переходит к следующему Child я не понимаю.. + нужно сделать: если показывается последний Child, тогда начинался снова первый... помогите плиз...