# XML Nested Loop - Access the Loop later... but how?

**URL:** https://forum.kirupa.com/t/xml-nested-loop-access-the-loop-later-but-how/216704
**Category:** flash
**Created:** [February 19, 2007, 8:31pm UTC](https://forum.kirupa.com/t/xml-nested-loop-access-the-loop-later-but-how/216704 "2007-02-19T20:31:40Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![YoungNastyMan](https://avatars.discourse-cdn.com/v4/letter/y/a6a055/32.png) [@YoungNastyMan](https://forum.kirupa.com/u/YoungNastyMan)
#### Post date: [February 19, 2007, 8:31pm UTC](https://forum.kirupa.com/t/xml-nested-loop-access-the-loop-later-but-how/216704/1 "2007-02-19T20:31:40Z")

</div>

Hello all. I need help desperately, I’m very novice with this kinda stuff. Basically, I have data organized by date in an XML file. I’m trying to make a website application that will allow the user to click on a date (in a text field) to see another textfield populate with all the data under that particular date.

So far, all the information loads into the textboxes at the same time. How can I get it to only load information under a particular date when somebody clicks on that date?

Before I started this project, I was convinced I could do this by manipulating the [j] (see code below) in the myFunc2 function. Currently, it’s set up to increment [COLOR=#ff0000][COLOR=black]blank\_mc.\_y[/COLOR] [/COLOR][COLOR=black]by whatever value is returned by [j]. But for some reason this doesn’t work. I feel that if I could atleas get this part to work - I could probably do the rest.[/COLOR]

Any help is greatly appreciated. PS - I’m not sure I even need a nested loop for this…

AS code:

```auto
function loadXML(loaded) {
 if (loaded) {
  var nodes = this.firstChild;
  for (j=0; j<nodes.childNodes.length; j++) {
       groups = nodes.childNodes[j];
       var info = groups.childNodes;
 
       for (i=0; i<info.length; i++) { 
             var word2 = groups.childNodes*.childNodes[0].firstChild.nodeValue;
             var url2 = groups.childNodes*.childNodes[1].firstChild.nodeValue;
 
          _root.myText.htmlText +="<A HREF=\"asfunction:MyFunc,"+url2+" \">"+word2+"
</A>";
              }
 
   _root.myGroup.htmlText +="<A HREF=\"asfunction:MyFunc2,"+[COLOR=#ff0000][j][/COLOR]+" \">"+groups.attributes.title+"
</A>";
 
  }
 }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("links.xml");   
 
function MyFunc2 (blarg) {
 //trace (blarg);
  //trace (blank_mc._y);
[COLOR=red]blank_mc._y = blarg;[/COLOR]
 }
 
function MyFunc (arg) {
 loadMovie(arg, holder_mc);
 };

```

XML Code:

```auto
<?xml version="1.0" ?>
<products>
<group1 title="January">
 <item>
  <one>foo</one>
  <two>foo.swf</two>
 </item>
 <item>
  <one>beans</one>
  <two>beans.swf</two>
 </item>
 <item>
  <one>spiders</one>
  <two>spiders.swf</two>
 </item>
</group1>
<group2 title="February">
 <item>
  <one>foo2</one>
  <two>foo2.swf</two>
 </item>
 <item>
  <one>beans2</one>
  <two>beans2.swf</two>
 </item>
 <item>
  <one>spiders2</one>
  <two>spiders2.swf</two>
 </item>
</group2>
</products>

```
