Ask a Question related to Macromedia Flash Data Integration, Design and Development.

  1. #1

    Default XML nested Loop?

    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 Guest

  2. Similar Questions and Discussions

    1. #40768 [NEW]: nested foreach break -- infinite loop - serious
      From: rave235 at gmail dot com Operating system: winxp PHP version: 5.2.1 PHP Bug Type: Scripting Engine problem Bug...
    2. Nested Loop
      Hi I am attempting to output this data using a table but things do output very well. Do I need nested looping. Thanks <table width='100%'...
    3. Nested loop woes.
      Hi, I am quite new to using Director and am having some trouble with some nested loops. I am trying to create a drum machine, whereby users...
    4. Film loop rollovers working with tell sprite, but only if Loop is checked
      on mouseWithin me cursor 280 tell sprite 40 --the sprite containing the film loop sprite(60).member = member("networkmapsbuttonroll") --swapping...
    5. Question on Dynamic Array/Nested Loop approach
      Hello, I have the following code which populates as table data from a SQL Server 2000 stored proc (RSByDemoID2). Below that is the view and...
  3. #2

    Default Re: XML nested Loop?

    Solved it ..works nicely :D
    ty anyways.


    //cleaner
    "cLeAnEr" <niclas.meyer@vesam.se> skrev i meddelandet
    news:ekm1vc$r8h$1@forums.macromedia.com...
    > 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 Guest

  4. #3

    Default RE: XML nested Loop?

    Well now im sitting here 3 years later with the same problem. Is there someway i could get a completed version of the code please? Anyone

    Posted via DevelopmentNow.com Group
    [url]http://www.developmentnow.com/g/[/url]
    Pinnennet Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139