# Kirupas XML Photogallery - Picture description

**URL:** <https://forum.kirupa.com/t/kirupas-xml-photogallery-picture-description/173104>\
**Category:** flash\
**Created:** [December 21, 2005, 8:42am UTC](https://forum.kirupa.com/t/kirupas-xml-photogallery-picture-description/173104 "2005-12-21T08:42:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stein](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@stein](https://forum.kirupa.com/u/stein)\
**Post date:** [December 21, 2005, 8:42am UTC](https://forum.kirupa.com/t/kirupas-xml-photogallery-picture-description/173104/1 "2005-12-21T08:42:12Z")

</div>

I´m using Kirupas XML Photogallery tutorial to make a portfolio, and what i want to do is add an extra textfield which gets an imagedescription from the XML file. How would I go about that?

I don’t understand how the “caption” tag winds up in the “desc\_txt” textfield.

Here is the FLA code:

function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
image = [];  
description = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
image\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
description\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
description2\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
}  
firstImage();  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“gallery/xml/yara.xml”);  
/////////////////////////////////////  
listen = new Object();  
listen.onKeyDown = function() {  
if (Key.getCode() == Key.LEFT) {  
prevImage();  
} else if (Key.getCode() == Key.RIGHT) {  
nextImage();  
}  
};  
Key.addListener(listen);  
previous\_btn.onRelease = function() {  
prevImage();  
};  
next\_btn.onRelease = function() {  
nextImage();  
};  
/////////////////////////////////////  
p = 0;  
\_root.content4.onEnterFrame = function() {  
filesize = \_root.content4.picture.getBytesTotal();  
loaded = \_root.content4.picture.getBytesLoaded();  
\_root.content4.preloader.\_visible = true;  
if (loaded != filesize) {  
\_root.content4.preloader.preload\_bar.\_xscale = 100\*loaded/filesize;  
} else {  
\_root.content4.preloader.\_visible = false;  
if (\_root.content4.picture.\_alpha\<100) {  
\_root.content4.picture.\_alpha += 10;  
}  
}  
};  
function nextImage() {  
if (p\<(total-1)) {  
p++;  
if (loaded == filesize) {  
\_root.content4.picture.\_alpha = 0;  
\_root.content4.picture.loadMovie(image[p], 1);  
\_root.content4.desc\_txt.text = description[p];  
picture\_num();  
}  
}  
}  
function prevImage() {  
if (p\>0) {  
p–;  
\_root.content4.picture.\_alpha = 0;  
\_root.content4.picture.loadMovie(image[p], 1);  
\_root.content4.desc\_txt.text = description[p];  
\_root.content4.desc2\_txt.text = description2[p];  
picture\_num();  
}  
}

function firstImage() {  
if (loaded == filesize) {  
p = 0;//reset it back to 0  
\_root.content4.picture.\_alpha = 0;  
\_root.content4.picture.loadMovie(image[0], 1);  
\_root.content4.desc\_txt.text = description[0];  
picture\_num();  
}  
}

function picture\_num() {  
current\_pos = p+1;  
\_root.content4.pos\_txt.text = current\_pos+" / "+total;  
}

The XML:

\<?xml version=“1.0” encoding=“utf-8” standalone=“yes”?\>

\<images\>

```
&lt;pic&gt;

    &lt;image&gt;http://www.1234.no/1234567/gallery/bilder/yara_grasaat.jpg&lt;/image&gt;

    &lt;caption&gt;Yara Formates&lt;/caption&gt;

&lt;/pic&gt;

```

\</images\>

Any help appreciated!

Stein
