2 Replies Latest reply on Nov 1, 2008 7:55 AM by m_hartnett

    XML

    sakura102384
      Hi everyone, got a problem with my application and just trying to seek some advice to well experienced flex developers in the community, hope you guys can help me...please!!!

      what i was trying to do is to get each node value of my external XML and put it in a <mx:label> tag each. Here's the example structure of my XML document.

      <gallery>
      <image>
      <filename>pic1.jpg</filename>
      <title>picture 1</title>
      <answers>
      <label>answer 1</label>
      <label>answer 2</label>
      <label>answer 3</label>
      </answers>
      </image>
      </gallery>

      Question: Is there any way where I can put answer 1, answer 2, and answer 3 in 3 different label tags? If there some way can somebody help me how, coz i badly need it immediately. please..... I was able to get the values of the 3 sub nodes of <answers> node but i only tried to put it in a single <mx:label> tag and wasn't able to parse it one by one.

      Help me good guys please!!!!

      Many Thanks!


        • 1. Re: XML
          Mark.P. Level 1
          Did you try to use the reapeater? Depending on what you're trying to accomplish that will work.

          <mx:Repeater id="rp" dataProvider="{arrayCollection}">
          <mx:Label text="{rp.currentItem}" />
          </mx:Repeater>
          • 2. Re: XML
            m_hartnett Level 3
            If you are looking to directly access the node there are many ways to do it. Here is one simple way. This will return you a XMLList of the nodes.

            var answerLabels : XMLList = someXMLdata.children().child("answers").children();