# Loading an image through xml (not image gallery, just a single image)

**URL:** <https://forum.kirupa.com/t/loading-an-image-through-xml-not-image-gallery-just-a-single-image/239047>\
**Category:** programming\
**Created:** [September 18, 2007, 9:48am UTC](https://forum.kirupa.com/t/loading-an-image-through-xml-not-image-gallery-just-a-single-image/239047 "2007-09-18T09:48:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lill](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Lill](https://forum.kirupa.com/u/Lill)\
**Post date:** [September 18, 2007, 9:48am UTC](https://forum.kirupa.com/t/loading-an-image-through-xml-not-image-gallery-just-a-single-image/239047/1 "2007-09-18T09:48:12Z")

</div>

hello, i tried this tutorial: [http://www.kirupa.com/developer/actionscript/xmldataflash.htm](http://www.kirupa.com/developer/actionscript/xmldataflash.htm)  
That was about displaying text in flash through xml. But how do i do the same with [COLOR=Red]images/pictures[/COLOR]?

This is what i tried, but i couldent get the [COLOR=Red]picture[/COLOR] to work (just the text worked)  
(if you wonder, the word “**[COLOR=SeaGreen]bilde[/COLOR]**” means “**[COLOR=SeaGreen]image[/COLOR]**”)

Here is my xml tekst:

```auto
<?xml version="1.0" encoding="utf-8"?>
<innhold>
    <person>
        <tittel>tittel</tittel>
        <ingress>ingress</ingress>
        [COLOR=Red] **<bilde>image.jpg</bilde>** [/COLOR]
    </person>
    <person>
        <tittel>tittel 2</tittel>
        <ingress>ingress2</ingress>
    </person>
</innhold>

```

here is my actionscript:

```auto

function loadXML(loaded) {
if (loaded) {

_root.tittel = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;
_root.ingress = this.firstChild.childNodes[0].childNodes[1].firstChild.nodeValue;
**[COLOR=Red]_root.bilde = this.firstChild.childNodes[0].childNodes[2].firstChild.nodeValue;[/COLOR]**
tittel_txt.text = _root.tittel;
ingress_txt.text = _root.ingress;
[COLOR=Red] **bilde1_txt.text = _root.bilde;** [/COLOR]

_root.tittel2 = this.firstChild.childNodes[1].childNodes[0].firstChild.nodeValue;
_root.ingress2 = this.firstChild.childNodes[1].childNodes[1].firstChild.nodeValue;
tittel2_txt.text = _root.tittel2;
ingress2_txt.text = _root.ingress2;

} else {
  trace("dosn't load");

}

}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("tekst.xml");

```

what do i do wrong?

---

<div class="post-metadata">

**Author:** ![pockitz](https://avatars.discourse-cdn.com/v4/letter/p/c5a1d2/32.png) [@pockitz](https://forum.kirupa.com/u/pockitz)\
**Post date:** [May 23, 2008, 12:21pm UTC](https://forum.kirupa.com/t/loading-an-image-through-xml-not-image-gallery-just-a-single-image/239047/2 "2008-05-23T12:21:06Z")

</div>

[http://www.kirupa.com/developer/mx2004/xml\_flash\_photogallery.htm](http://www.kirupa.com/developer/mx2004/xml_flash_photogallery.htm)
