# How to populate a MovieClip dynamically?

**URL:** <https://forum.kirupa.com/t/how-to-populate-a-movieclip-dynamically/251482>\
**Category:** flash\
**Created:** [February 8, 2008, 9:48pm UTC](https://forum.kirupa.com/t/how-to-populate-a-movieclip-dynamically/251482 "2008-02-08T21:48:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ltwilley1](https://avatars.discourse-cdn.com/v4/letter/l/3d9bf3/32.png) [@ltwilley1](https://forum.kirupa.com/u/ltwilley1)\
**Post date:** [February 8, 2008, 9:48pm UTC](https://forum.kirupa.com/t/how-to-populate-a-movieclip-dynamically/251482/1 "2008-02-08T21:48:49Z")

</div>

When I click on a a set of MovieClips that I populated with XML, I want to be able to dynamically populate ANOTHER MovieClip. Why can’t I do this with the code I have written? The problem code is in red below.

ActionScript 2.0:

furniture\_xml = new XML();  
furniture\_xml.ignoreWhite = true;  
furniture\_xml.onLoad = function(success) {  
if (success) {  
var pieces\_xml = furniture\_xml.firstChild;  
var totalF = pieces\_xml.childNodes.length;

```
    for (var i = 0; i &lt; totalF; i++) {
           var pieceData = new Object();        
           aa = _root["furnHolder" + i];
        aa.furn_link_mc.loadMovie(pieces_xml.childNodes*.attributes.thumb, this.getNextHighestDepth());

```

[COLOR=Red]aa.onRelease = function(){  
for (var i = 0; i \< 4; i++){  
\_root.bigFurniture.loadMovie(pieces\_xml.childNodes\*.firstChild.nodeValue;, this.getNextHighestDepth());  
}

```
        }[/COLOR]
        
       }

```

} else {  
trace(“Error loading furniture.”);  
}

```
     delete furniture_xml;

```

}  
furniture\_xml.load(“furniture.xml”);

XML:

\<furniture\>  
\<piece thumb=“images/furniture0\_sm.jpg”\>images/furniture0.jpg\</piece\>  
\<piece thumb=“images/furniture1\_sm.jpg”\>images/furniture1.jpg\</piece\>  
\<piece thumb=“images/furniture2\_sm.jpg”\>images/furniture2.jpg\</piece\>  
\<piece thumb=“images/furniture3\_sm.jpg”\>images/furniture3.jpg\</piece\>  
\</furniture\>
