PDA

View Full Version : Using XML



BrianH158
October 3rd, 2005, 03:38 PM
So I'm using this (http://www.kirupa.com/developer/actionscript/xmldataflash.htm) to display my XML Data and it's working fine but my question is.. How can I set it so that people viewing the Data can scroll back or click a button to view past "nodes" of data.

For example I'm using this to display a list of who's playing in a show the upcoming weekend. As it is now it just shows the most recent entry, how can I make it so people can view past Cast List?

grappaFruit
October 4th, 2005, 07:01 AM
I don't know the content tree of your xml, but let's say you place the context in the first tree layer as text node... something quick & dirty:


for(a=0;a<myXML.firstChild.childNodes.length;a++){
If(myText.text==myXML.firstChild.childNodes[a].firstChild.nodeValue){
if(!a){myText.text=myXML.firstChild.childNodes[a-1].firstChild.nodeValue}
else{myText.text=myXML.firstChild.lastChild.firstC hild.nodeValue}
}
}

Call this snippet when you click a button, and the text will change to the previous text node, if the text node is the first in the row, it skips to the last one...

Just typed something, but I think it could work. There are probably cleaner ways, but hey, like I said: quick & dirty :)