2 Replies Latest reply on Oct 19, 2009 12:44 AM by zakabalt

    A little change in my tree path function

    zakabalt

      Hello, I have a tree that receive this XML as data, and I want to know what is the path of one node, for example if I do click in Documentation I want to receive INBOX.Drafts.Flex.Documentation. I have a function to do that but I get that. prueba@xxxx.com.INBOX.Drafts.Flex.Documentation. But id on't want the first node(prueba@xxxx.com). Here the xml and my function. What I have to change to get  INBOX.Drafts.Flex.Documentation?

       

      <?xml version="1.0" encoding="UTF-8"?>
      <Cuentas>
        <Cuenta id="cuenta1" label="prueba@XXXXX.com">
          <node label="INBOX" id="(2)">
            <node label="Drafts" />
            <node label="Flex" id="(49)">
              <node label="Codigo" />
              <node label="Documentacion" />
            </node>
            <node label="Sent" />
            <node label="Trash" />
          </node>
        </Cuenta>
        <Cuenta id="cuenta2" label="prueba@YYYYY.com">
          <node label="INBOX">
            <node label="Name">
              <node label="Surname" />
            </node>
            <node label="Carpeta1" id="(37)">
              <node label="Carpeta11" />
            </node>
            <node label="Trash" />
          </node>
        </Cuenta>
      </Cuentas>

      public function getRuta():String {
                   var item:Object = newTree.selectedItem;
                    ruta=item.@label
                    while (true){
                         if (newTree.getParentItem(item) != null){
                             item=newTree.getParentItem(item)
                          ruta = item.@label + "." + ruta;
                         }else {break;}
                     }
                     return ruta;
              }

       

      I think that the difference is small but I don't know how can I do. I have to say that the xml is not always the same, sometimes have 3 fathers, or 5 fathers or... I want something dinamic.

       

      Thanks!