# Making my loaded images movieclips

**URL:** <https://forum.kirupa.com/t/making-my-loaded-images-movieclips/273813>\
**Category:** Uncategorized\
**Created:** [October 21, 2008, 9:21am UTC](https://forum.kirupa.com/t/making-my-loaded-images-movieclips/273813 "2008-10-21T09:21:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RossKidd](https://avatars.discourse-cdn.com/v4/letter/r/53a042/32.png) [@RossKidd](https://forum.kirupa.com/u/RossKidd)\
**Post date:** [October 21, 2008, 9:21am UTC](https://forum.kirupa.com/t/making-my-loaded-images-movieclips/273813/1 "2008-10-21T09:21:31Z")

</div>

I have loaded my images with xml and am trying to give them instancenames and attach an eventlistener to them. This is what I have so far

var xml:XML;  
var xmlList:XMLList;  
var xmlLoader:URLLoader = new URLLoader();  
var container:MovieClip = new MovieClip();  
var imageLoader:Loader;

[//container.addEventListener](https://container.addEventListener)(MouseEvent.MOUSE\_MOVE, changeThumb)  
xmlLoader.load(new URLRequest(“images.xml”));  
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

/\*function xmlLoaded(event:Event):void {

```
{
    
    xml = XML(event.target.data);
    xmlList = xml.children;
    
    for(var i:int = 0; i &lt; xmlList.length();
    
}
*/

function xmlLoaded(event:Event):void {

    xml = XML(event.target.data);
    xmlList = xml.children();
    
    
    for(var i:int = 0; i &lt; xmlList.length(); i++)
{
    
    imageLoader = new Loader();
    imageLoader.load(new URLRequest(xmlList*.attribute("source")));
    
    
    imageLoader.x = 25;
    imageLoader.y = i * 150 ;
    
    var mcimage:MovieClip = new MovieClip ();
    mcimage.name = "myimage" + i;
    mcimage.addEventListener(MouseEvent.CLICK, tellme);
    addChild(mcimage);
    myimage.addChild(imageLoader);
    
    
    
    
    
    function tellme(Event:MouseEvent) {
        trace(event.target.name);
        
    }
    
}

}
```
