# Loading xml from button to external movieclip

**URL:** <https://forum.kirupa.com/t/loading-xml-from-button-to-external-movieclip/241592>\
**Category:** Uncategorized\
**Created:** [October 15, 2007, 11:00pm UTC](https://forum.kirupa.com/t/loading-xml-from-button-to-external-movieclip/241592 "2007-10-15T23:00:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bonwhis](https://avatars.discourse-cdn.com/v4/letter/b/b77776/32.png) [@Bonwhis](https://forum.kirupa.com/u/Bonwhis)\
**Post date:** [October 15, 2007, 11:00pm UTC](https://forum.kirupa.com/t/loading-xml-from-button-to-external-movieclip/241592/1 "2007-10-15T23:00:21Z")

</div>

Hi guys

I am trying to make a portfolio site with different picture galleries. Every gallery is supposed to work the same way, but the pictures will be different(ofcourse). The problem is that I can’t make it work unless I make an individual swf file for each gallery. With my actionscript knowledge I am therefore quite limited…

I need to be able to make a function so that every button opens up the same movieclip but with at different xml file attached to it, can anyone help.  
This is what I have so far, but getting it on a button is harder than I thought.

```auto
function loadXML(loaded) {
    if (loaded) {
        xmlNode = this.firstChild;
        image = [];
        description = [];
        infotext = [];
        total = xmlNode.childNodes.length;
        for (i=0; i<total; i++) {
            image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
            description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
            infotext* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
        }
        firstImage();
    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("content/xml_folder/row_a.xml");

```

All help is greatly appreciated…

-B
