# How do I stack movieclips underneath each other using attachmovie?

**URL:** <https://forum.kirupa.com/t/how-do-i-stack-movieclips-underneath-each-other-using-attachmovie/226430>\
**Category:** flash\
**Created:** [May 21, 2007, 1:52pm UTC](https://forum.kirupa.com/t/how-do-i-stack-movieclips-underneath-each-other-using-attachmovie/226430 "2007-05-21T13:52:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thesainter](https://avatars.discourse-cdn.com/v4/letter/t/b782af/32.png) [@thesainter](https://forum.kirupa.com/u/thesainter)\
**Post date:** [May 21, 2007, 1:52pm UTC](https://forum.kirupa.com/t/how-do-i-stack-movieclips-underneath-each-other-using-attachmovie/226430/1 "2007-05-21T13:52:43Z")

</div>

Here is some code I have been using. The movieclips stac on top of each other.

function loadXML(true) {  
if (true) {  
xmlNode = this.firstChild;  
title = [];  
info = [];  
url = [];  
show\_content();  
} else {  
trace(“file not loaded!”);  
}  
}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“news.xml”);

function show\_content() {

//Starting x & y values  
var xPos = 15;  
var yPos = 0;  
total = xmlNode.childNodes.length;

//For loop to attach our container movieclip and pass the xml information  
for(i=0;i\<total;i++){

//define xml \*\*\*\*  
title\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
url\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
info\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;

//attach the container clip  
currMovie = attachMovie(“newsFolder”, “xml”+i, i, {\_x:xPos, \_y:yPos});

//increase the y postion each time  
xPos += currMovie.folder.\_width-3;

//add the information  
currMovie.but.name.text = title\*;  
[//currMovie.interest.text](https://currMovie.interest.text) = info\*;  
currMovie.but.url = url\*;

}  
}
