# Photo Gallery Using XML and Flash- add child?

**URL:** <https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-add-child/246002>\
**Category:** flash\
**Created:** [December 6, 2007, 7:03am UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-add-child/246002 "2007-12-06T07:03:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shiftless13](https://avatars.discourse-cdn.com/v4/letter/s/9d8465/32.png) [@shiftless13](https://forum.kirupa.com/u/shiftless13)\
**Post date:** [December 6, 2007, 7:03am UTC](https://forum.kirupa.com/t/photo-gallery-using-xml-and-flash-add-child/246002/1 "2007-12-06T07:03:50Z")

</div>

I have just complete the Photo Gallery tutorial and am trying to modify it as a next step. I have added another child called “header” in the XML file as such:

```auto
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>images/clean.jpg</image>
        <caption>Some text.</caption>
        <header>Tomorrow's clean room today.</header>
    </pic>
    <pic>
        <image>images/color.jpg</image>

        <caption>More text.</caption>
        <header>Pick A Color</header>
    </pic>
    <pic>
        <image>images/video.jpg</image>

        <caption>Even More text.</caption>
        <header>See It Now!</header>
    </pic>
</images>

```

I created another dynamic text field and named the instance “header\_txt”.

I am trying to create an array of the children here in the actionscript:

```auto
xmlNode = this.firstChild;
image = [];
description = [];
header = [];
total = xmlNode.childNodes.length;
for (i=0; i<total; i++) {

image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
header* = xmlNode.childnodes*.childNodes[2].firstChild.nodeValue;
}

```

I don’t think that last line is correct for getting the headers, how should it be written? I keep getting “undefined” when I test.

Just for more info, here is script that is called when you hit button 1. (I am having 3 buttons, one for each image like a navigation):

```auto
function firstImage() {

if (loaded == filesize) {

picture._alpha = 0;
picture.loadMovie(image[0], 1);
desc_txt.text = description[0];
header_txt.text = header[0];
picture_num();

}

```

The images and the captions all load fine, but not the header, can anyone tell what I am doing wrong? Thanks
