# For loop not cycling thru for xml

**URL:** <https://forum.kirupa.com/t/for-loop-not-cycling-thru-for-xml/207798>\
**Category:** Uncategorized\
**Created:** [November 21, 2006, 4:47pm UTC](https://forum.kirupa.com/t/for-loop-not-cycling-thru-for-xml/207798 "2006-11-21T16:47:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kredd](https://avatars.discourse-cdn.com/v4/letter/k/848f3c/32.png) [@kredd](https://forum.kirupa.com/u/kredd)\
**Post date:** [November 21, 2006, 4:47pm UTC](https://forum.kirupa.com/t/for-loop-not-cycling-thru-for-xml/207798/1 "2006-11-21T16:47:24Z")

</div>

hello all, i’ve got a ‘for loop’ attaching a movieclip and for each iteration i’m also creating a textfield. the loop is creating the correct number of MC’s and the correct number of textfields (just one per) in those MC’s. my problems is getting the xml data into those txtfields. the data only shows up in the first textfield…all the others(the number varies) are ‘undefined’…

```auto
 
for (var z = 0; z < bldgFacts; z++){ // start looping through xml
 
  var item_mc = _root.swaps.facts_holder.attachMovie("facts","facts"+item_count, item_count);
   item_mc._y = item_count * item_spacing;
 
   item_mc.createTextField("factstxt"+z,1,0,0,378,45);
   item_mc["factstxt"+z].text = seasArts.firstChild.childNodes[n].childNodes[2].firstChild.childNodes[z].nodeValue;
   item_mc["factstxt"+z].setTextFormat(facts);
 
  item_count++;
  trace(item_mc["factstxt"+z])

```

here is a snippet of my xml file…

```auto

<item>
   <title>The Hardeman House</title>
   <btn>btn1</btn>
   <bldg_info>
      <fact_one>1111</fact_one> <--- the data i'm trying to access!
      <fact_two>2222</fact_two> <--- the data i'm trying to access!
      <fact_three>3333</fact_three> <--- the data i'm trying to access!
      <fact_four>4444</fact_four> <--- the data i'm trying to access!
   </bldg_info>
   <photo>.../photos/hardemanhouse.jpg</photo>
   <movie_clip>.../ropes_course.flv</movie_clip> 
  </item>

```

any ideas? it seems like i’ve traced everything and it all looks correct, but obviously it ain’t 😉 thanks!
