Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / November 2006



Tip: Looking for answers? Try searching our database.

XML nested Loop?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
cLeAnEr - 30 Nov 2006 07:41 GMT
hi all.

I´ve just completed a little test for making a tree component with custom
icons / bransch.
However, i can only get my first branch to show custom icons.(links -
document) I figure I need to make a nested loop to Iterate over
nextSibling?. I tried ALOT, but i guess I´m doing something completely
wrong.

here is code for my tree so far:

my_xml = new XML();
my_xml.ignoreWhite = true;
my_xml.load("tree.xml");

my_xml.onLoad = function(){
myTree.dataProvider = this.firstChild;

var folders = my_xml.firstChild.firstChild;
var docs = folders.childNodes;

for (var i=0; i < docs.length; i++){
 currDoc = docs[i];
  trace(docs[i]);

var docIcon = currDoc.attributes.pic;

switch(docIcon){
 case "pdf":
   myTree.setIcon(currDoc, "pdfIcon");
  break;
 case "word":
  myTree.setIcon(currDoc, "wordIcon");
  break;
 case "excel":
  myTree.setIcon(currDoc, "excelIcon");
  break;
 case "ie":
  myTree.setIcon(currDoc, "ieIcon");
  break;
 }//switch
} //for
};//onLoad

And here is the XML I used:

<node label="» Dokument typer">
<node label="» links - document">
 <node label="test.url" url="http://www." pic="ie" info="test text"  />
 <node label="test.doc" url="test.doc" pic="word" info="test text" />
 <node label="test.excel" url="test.xls" pic="excel" info="test text" />
 <node label="test.pdf" url="test.pdf" pic="pdf" info="test text." />
</node>
<node label="» Links - document">
 <node label="test URL" url="http://www." pic="ie" info="test text." />
 <node label="test URL" url="http://www." pic="ie" info="test text." />
</node>
</node>
cLeAnEr - 30 Nov 2006 10:05 GMT
Solved it ..works nicely :D
ty anyways.

//cleaner
> hi all.
>
[quoted text clipped - 54 lines]
> </node>
> </node>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.