# Convert an xml-loaded pic into a button

**URL:** <https://forum.kirupa.com/t/convert-an-xml-loaded-pic-into-a-button/297314>\
**Category:** flash\
**Created:** [September 30, 2009, 4:34am UTC](https://forum.kirupa.com/t/convert-an-xml-loaded-pic-into-a-button/297314 "2009-09-30T04:34:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![felipopulus](https://avatars.discourse-cdn.com/v4/letter/f/eb8c5e/32.png) [@felipopulus](https://forum.kirupa.com/u/felipopulus)\
**Post date:** [September 30, 2009, 4:34am UTC](https://forum.kirupa.com/t/convert-an-xml-loaded-pic-into-a-button/297314/1 "2009-09-30T04:34:53Z")

</div>

I’m new to Actionscript and to Kirupa… I looked everywhere for an answer but all the solutions are too convoluted.

Is there any way to load a picture via xml and convert it into a button afterwards?

The codes loads the correct picture but not nothing seems to happen when I add a mouse listener. see code.

```auto

var urls:Array = new Array();

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("menu/pics.xml");

function loadXML(loaded) {
    if (loaded) {
        var photos:Array = this.firstChild.childNodes;
        for(i=0;i<photos.length;i++) {
            urls.push(photos*.attributes.url);
        }
picloader1.loadMovie(urls[0]);
picloader2.loadMovie(urls[1]);
// etc... 

//it works fine until here. This next line isn't working. why?
picloader1.onRelease = function () {
    getURL("http://www.adobe.com", "_self");
};
}

```

Any insight to the solution is appreciated!!! thanks in advance.
