2 Replies Latest reply on Jul 24, 2007 7:41 PM by Kalen_G.

    Dynamic Object References

      Hi All,
      I need to concatenate a string to represent an object in the XML that is the data provider to my Flex tree. I need to drill into the XML structure by looping through the layers as so:

      loop 1: xmlString = xmlStructure.MTN[1]
      loop 2: xmlString = xmlStructure.MTN[1].MTN[3]
      loop 3: xmlString = xmlStructure.MTN[1].MTN[3].MTN[2]

      And then expand each item as we drill in:

      xmlDataTree.expandItem( this[xmlString],true);

      but I can't get the dynamic reference to work. I've tried all kinds of things like:

      xmlString = "MTN[1].MTN[2]";
      xmlDataTree.expandItem( xmlStucture[xmlString],true);

      Any ideas?

        • 1. Re: Dynamic Object References
          ntsiii Level 3
          What does the xml look like? Do a trace in the result handler function to be sure you have exactly what you expect.

          Also, this xmlStructure.MTN[1]
          returns an XML node not a string as your variable implies.

          put each node in a variable and check it with toXMLString() to make sure you are getting good node references.
          • 2. Dynamic Object References
            Kalen_G. Level 1
            The node references are fine. If I hard-code them in there like this:

            xmlDataTree.expandItem( xmlStructure.MTN[1].MTN[3] ,true);

            I get exactly what I want. All I need to do is take the xmlStructure.MTN[1].MTN[3] part and turn it into a variable that can be plugged in. I just can't get the syntax right.