# onRelease doesn't work

**URL:** <https://forum.kirupa.com/t/onrelease-doesnt-work/274685>\
**Category:** flash\
**Created:** [November 3, 2008, 3:32am UTC](https://forum.kirupa.com/t/onrelease-doesnt-work/274685 "2008-11-03T03:32:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwill207](https://avatars.discourse-cdn.com/v4/letter/c/c37758/32.png) [@cwill207](https://forum.kirupa.com/u/cwill207)\
**Post date:** [November 3, 2008, 3:32am UTC](https://forum.kirupa.com/t/onrelease-doesnt-work/274685/1 "2008-11-03T03:32:23Z")

</div>

I know there are other threads on this but I can’t make any sense of them. I am pulling thumbnails in from an xml and looping through the xml to create empty movie clips then loading the thumbnail. I want to make the thumbnails clickable using the onRelease but cant get it to work.

Here is my code:

=================

var xPosition:Number = 16;  
var yPosition:Number = 298;  
var xText:Number = 7;  
var yText:Number = 360;  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
thumb = [];  
total = xmlNode.childNodes.length;  
for (i=0; i\<total; i++) {  
video\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
thumb\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
movieTitle\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;

```
        if (i == 5) {                
            xPosition = 16;
            yPosition = yPosition + 105;
            xText = 9;
            yText = yText + 105;
        }
        _root.createEmptyMovieClip("myClip" + i, getNextHighestDepth());
        _root["myClip"+i].loadMovie(thumb*);
        _root["myClip"+i]._x = xPosition;
        _root["myClip"+i]._y = yPosition;
        _root["myText"+i]._x = xText;
        _root["myText"+i]._y = yText;
        _root.createTextField("myText"+i, getNextHighestDepth(), xText, yText, 105, 37); 
        
        myformat = new TextFormat();
        myformat.color = 0x000000;
        myformat.size =10;
        myformat.align="center";                
        myformat.font = "Arial";
        _root["myText"+i].text = '"' + movieTitle* + '"

```

’ + ‘TV Commercial’;  
\_root[“myText”+i].setTextFormat(myformat);

```
        xPosition = xPosition + 95;
        xText = xPosition - 9;            
        
        _root["myClip"+(i)].onRelease = function(){
            trace('onRelease running');
        }
    }                
} else {
    content = "file not loaded!";        
}

```

}

xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(assetPath);
