# XML loaded via attachMovie into MovieCLip

**URL:** <https://forum.kirupa.com/t/xml-loaded-via-attachmovie-into-movieclip/269149>\
**Category:** flash\
**Created:** [August 23, 2008, 11:02am UTC](https://forum.kirupa.com/t/xml-loaded-via-attachmovie-into-movieclip/269149 "2008-08-23T11:02:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![neofuturist](https://avatars.discourse-cdn.com/v4/letter/n/e480ec/32.png) [@neofuturist](https://forum.kirupa.com/u/neofuturist)\
**Post date:** [August 23, 2008, 11:02am UTC](https://forum.kirupa.com/t/xml-loaded-via-attachmovie-into-movieclip/269149/1 "2008-08-23T11:02:52Z")

</div>

Hello all, I  
'm pretty new with flash and right now I’m stuck with a problem that I don’t seem to come out off. I’m working on my new site that has 3 sections that each load a movieclip using attachMovie.

## Now the problem happens when I load the slideshow, its all broken and even if I change the \_root to \_parent or this, it doesn’t work can you please help me here’s the original code [http://pastebin.com/f35bd8861](http://pastebin.com/f35bd8861)

\_root.originThumbnailX = mc\_thumbnail.\_x;  
// The following is for the categories:  
var myXML:XML = new XML();  
myXML.ignoreWhite = true;  
myXML.load(“category.xml”);  
myXML.onLoad = loadXML;  
var catBtns:Array = Array();  
function loadXML(loaded) {  
if (loaded) {  
rootNode = this.firstChild;  
\_root.numberOfItem = rootNode.firstChild.childNodes.length;  
verticalDistance = rootNode.lastChild.childNodes[0].firstChild.nodeValue;  
for (var i = 0; i\<\_root.numberOfItem; i++) {  
menuList.categoryAll.m\_category.btn.duplicateMovieClip(“btn”+i, i);

```
        _root.main.menuList.categoryAll.m_category["btn"+i].theText = rootNode.firstChild.childNodes*.childNodes[0].firstChild.nodeValue;
        _root.main.menuList.categoryAll.m_category["btn"+i].theID = rootNode.firstChild.childNodes*.childNodes[1].firstChild.nodeValue;
        _root.main.menuList.categoryAll.m_category["btn"+i]._x = _root.main.menuList.categoryAll.m_category.btn0._x+(i*verticalDistance);
        _root.main.menuList.categoryAll.m_category["btn"+i].btnNumber = i;
        catBtns.push(_root.main.menuList.categoryAll.m_category["btn"+i]);
    }
    
    // set the first button as the default current button
    catBtns[0].gotoAndStop("2");
    _root.currentBtn = 0;
}

```

}

## function resetAllButtons() { catBtns[\_root.currentBtn].gotoAndPlay(“1”); }

thanks

Arnaud
