# Images to movieclips and classes

**URL:** <https://forum.kirupa.com/t/images-to-movieclips-and-classes/273763>\
**Category:** Uncategorized\
**Created:** [October 20, 2008, 2:31pm UTC](https://forum.kirupa.com/t/images-to-movieclips-and-classes/273763 "2008-10-20T14:31: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 20, 2008, 2:31pm UTC](https://forum.kirupa.com/t/images-to-movieclips-and-classes/273763/1 "2008-10-20T14:31:31Z")

</div>

Hi,

I am loading my images from a folder using xml. I need to

(i) turn them into movieclips and give them instance names (myimage1, myimage2)

(ii) attach my custom class (zoomImage) to my movieclips.

Thanks,

This is my code so far

: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: function xmlLoaded(event:Event):void {

```
            xml = XML(event.target.data);
            xmlList = xml.children();
            trace(xmlList.length());
            
            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 ;
            addChild(imageLoader);
            imageLoader.addEventListener(MouseEvent.CLICK, tellme);
            
            function tellme(Event:MouseEvent) {
                    trace(this);
                    
            }
            
    }
    
    }
```
