# XML Loop Problem?

**URL:** <https://forum.kirupa.com/t/xml-loop-problem/220830>\
**Category:** flash\
**Created:** [March 29, 2007, 5:16pm UTC](https://forum.kirupa.com/t/xml-loop-problem/220830 "2007-03-29T17:16:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![villaaston](https://avatars.discourse-cdn.com/v4/letter/v/dfb087/32.png) [@villaaston](https://forum.kirupa.com/u/villaaston)\
**Post date:** [March 29, 2007, 5:16pm UTC](https://forum.kirupa.com/t/xml-loop-problem/220830/1 "2007-03-29T17:16:37Z")

</div>

I’ve got this code:

```auto
    function loadtheContent(menu_xml) {
        var items = menu_xml.firstChild.childNodes;
        trace(items);
        trace("image: "+items[0].childNodes[2].childNodes[1].attributes.url);
        trace("name: "+items[0].childNodes[0].firstChild.nodeValue);
        makeText("content_header", "Basic-11-Bold", 16, menu_xml.firstChild.attributes.title, 50, 65, 500, 500, 1, 0xffffff, 1, 1);
        prevX = 50;
        for (var i = 0; i<items.length; i++) {
            trace("i: "+i);
            trace("image: "+items*.childNodes[2].childNodes[0].attributes.url);
            trace("name: "+items*.childNodes[0].firstChild.nodeValue);
            item_mc = attachMovie("team_item", "team_item"+i, this.getNextHighestDepth(), {_x:prevX, _y:160});
            item_mc.img.loadMovie("team_pics/"+items*.childNodes[2].childNodes[0].attributes.url);
            item_mc.img._x = 10;
            item_mc.img._y = -54;
            item_mc.makeText("item_team_name"+i, "Basic-11-Bold", 10, items*.childNodes[0].firstChild.nodeValue, 8, 23, 81, 500, 1, 0xffffff, 1, 1);
            item_mc.makeText("item_team_pos"+i, "Basic-11", 10, items*.childNodes[1].firstChild.nodeValue, 8, 36, 81, 500, 0, 0xffffff, 1, 1);
            item_mc.bg.easeTo("_alpha", 25);
            fadein(item_mc);
            prevX = prevX+100;
        }
    }

```

and this xml:

```auto
<?xml version="1.0" encoding="iso-8859-1"?>
<team title="the team">
    <member>
        <name>James Easley</name>
        <position>Managing Director</position>
        <images>
            <item url="James_mask_cropped.jpg" />
            <item url="James_cropped_2.jpg" />
            <item url="James_cropped_3.jpg" />
        </images>
        <personal>
            <item title="Likes">shiny stuff. kickboxing. good food. good design. girly drinks. lightsabers</item>
            <item title="Fav film">Gotta say 'Empire' but Donnie Darko and Fear & Loathing in Las Vegas are a close 2nd</item>
            <item title="Pivotal moment in life">realising that Tripitaka was actually a woman. And i spose http://news.bbc.co.uk/1/hi/health/6505923.stm</item>
            <item title="Fav quote">There ain't no party like an S Club party</item>
        </personal>
    </member>
    <member>
        <name>Matthew Down</name>
        <position>Marketing Assistant</position>
        <images>
            <item url="mattpic1_cropped.jpg" />
        </images>
        <personal>
            <item title="Likes">shiny stuff. kickboxing. good food. good design. girly drinks. lightsabers</item>
            <item title="Fav film">Gotta say 'Empire' but Donnie Darko and Fear & Loathing in Las Vegas are a close 2nd</item>
            <item title="Pivotal moment in life">realising that Tripitaka was actually a woman. And i spose http://news.bbc.co.uk/1/hi/health/6505923.stm</item>
            <item title="Fav quote">There ain't no party like an S Club party</item>
        </personal>
    </member>
    <member>
        <name>James Easley</name>
        <position>Managing Director</position>
        <images>
            <item url="James_mask_cropped.jpg" />
            <item url="James_cropped_2.jpg" />
            <item url="James_cropped_3.jpg" />
        </images>
        <personal>
            <item title="Likes">shiny stuff. kickboxing. good food. good design. girly drinks. lightsabers</item>
            <item title="Fav film">Gotta say 'Empire' but Donnie Darko and Fear & Loathing in Las Vegas are a close 2nd</item>
            <item title="Pivotal moment in life">realising that Tripitaka was actually a woman. And i spose http://news.bbc.co.uk/1/hi/health/6505923.stm</item>
            <item title="Fav quote">There ain't no party like an S Club party</item>
        </personal>
    </member>
</team>

```

Just as a test obviously. It al seems to work fine, apart from only the last member in the xml is actually displayed. This is my trace:

```auto
i: 0
image: James_mask_cropped.jpg
name: James Easley
makeText: item_team_name0
fadein called for_level0.team_item0.item_team_name0
makeText: item_team_pos0
fadein called for_level0.team_item0.item_team_pos0
fadein called for_level0.team_item0
i: 1
image: mattpic1_cropped.jpg
name: Matthew Down
makeText: item_team_name1
fadein called for_level0.team_item1.item_team_name1
makeText: item_team_pos1
fadein called for_level0.team_item1.item_team_pos1
fadein called for_level0.team_item1
i: 2
image: James_mask_cropped.jpg
name: James Easley
makeText: item_team_name2
fadein called for_level0.team_item2.item_team_name2
makeText: item_team_pos2
fadein called for_level0.team_item2.item_team_pos2
fadein called for_level0.team_item2

```

Which should mean they’ve been created? I’m obviously missing something easy but I’ve been looking at it too long now…

Any help much appreciated. Cheers.

Gav
