# onRelease on dynamicly added movieclips

**URL:** <https://forum.kirupa.com/t/onrelease-on-dynamicly-added-movieclips/293889>\
**Category:** flash\
**Created:** [August 5, 2009, 1:09pm UTC](https://forum.kirupa.com/t/onrelease-on-dynamicly-added-movieclips/293889 "2009-08-05T13:09:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blackan](https://avatars.discourse-cdn.com/v4/letter/b/898d66/32.png) [@blackan](https://forum.kirupa.com/u/blackan)\
**Post date:** [August 5, 2009, 1:09pm UTC](https://forum.kirupa.com/t/onrelease-on-dynamicly-added-movieclips/293889/1 "2009-08-05T13:09:03Z")

</div>

I’m trying to add images from an XML and making them clickable. It’s been a while since I did some actionscripting, som I’m a little rusty. Thought this would work but they won’t let me click them 😛 Any ideas?

```auto
var xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = processXMLData;
xmlData.load("bilder.xml");

var img = new Array();
var holdNum = new String();
var rh = new String();
var base = _root.baseHolder;

var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);

function processXMLData(success) {
    if (success) {
        for (var i=0; i < this.firstChild.childNodes.length; i++) {
            img* = this.firstChild.childNodes*.attributes.src;
        }
        var totImg = img.length;
        
        for(var j=0; j < totImg; j++) {
            holdNum = "imgHolder" + j;
            _root.createEmptyMovieClip(holdNum, _root.getNextHighestDepth());
            mcLoader.loadClip(img[j], holdNum);
            rh = _root[holdNum];
            sc = 16;
            rh._xscale = sc;
            rh._yscale = sc;
            rh._x = j*150;
            
            rh.onRelease = function () {
                trace("working");
            }
        }
    }
}

```
