# XML and Text Field FOR loop question, can someone please help?

**URL:** https://forum.kirupa.com/t/xml-and-text-field-for-loop-question-can-someone-please-help/281105
**Category:** flash
**Created:** [February 4, 2009, 10:17pm UTC](https://forum.kirupa.com/t/xml-and-text-field-for-loop-question-can-someone-please-help/281105 "2009-02-04T22:17:13Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![monsterchild](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@monsterchild](https://forum.kirupa.com/u/monsterchild)
#### Post date: [February 4, 2009, 10:17pm UTC](https://forum.kirupa.com/t/xml-and-text-field-for-loop-question-can-someone-please-help/281105/1 "2009-02-04T22:17:13Z")

</div>

hi all,  
ok, i’m really having a hard time trying to get this to work, hopefully someone will be kind enough to shed some light on this…

```auto
function onLoaded(e:Event):void {

        xml = new XML(e.target.data);
        var sF:XMLList = xml.tenant.floorN;
        var sC:XMLList = xml.tenant.company;
        //
        sFloor0.appendText(sF.text()[0]);
        sCompany0.appendText(sC.text()[0]);
        //
        sFloor1.appendText(sF.text()[1]);
        sCompany1.appendText(sC.text()[1]);
        //
        sFloor2.appendText(sF.text()[2]);
        sCompany2.appendText(sC.text()[2]);
        //
        sFloor3.appendText(sF.text()[3]);
        sCompany3.appendText(sC.text()[3]);
    }
  

```

the code above outputs exactly what i need it to do to the specific dynamic text fields i’ve assigned, but i was hoping that there is a way to put this in a FOR loop?

this code below works in the output panel

```auto
for (var i:Number=0; i<sC.length(); i++) {
            trace(sF.text()*);
            trace(sC.text()*);
        }

```

but i can’t get it to work with multiple text fields, can somebody please help me out?

thanks  
chris
