Function on dynamicaly created movie clips

importSubtemplate = new XML();
importSubtemplate.ignoreWhite = true;
importSubtemplate.onLoad = function(success) {
if (success) {
var depth = 0;
var nextY = 10;
count = 0;

var res = loadSubTemplate();
var res:String = “” + res + “”;
var tempimage:Array = res.split(",");

for (var j = 0; j<tempimage.length; j++) {
title = importSubtemplate.firstChild.childNodes[j].attributes.title;
thumbnail = importSubtemplate.firstChild.childNodes[j].attributes.thumbnail;
posx = importSubtemplate.firstChild.childNodes[j].attributes.xcoord;
posy = importSubtemplate.firstChild.childNodes[j].attributes.ycoord;

var moviename = “moviename” + j;
var movielevel = 1+j;

[COLOR=red]_root.createEmptyMovieClip(“movie_mc”, 25);
movie_mc.createEmptyMovieClip([moviename], movielevel);
loadMovie(“images/” + thumbnail + “.jpg”, movie_mc[moviename]);
setProperty(movie_mc[moviename], _x, posx);
setProperty(movie_mc[moviename], _y, posy); [/COLOR]
}

[COLOR=darkred]movie_mc.onRelease = function() {
trace(movie_mc[moviename]);
};[/COLOR]

}
}

importSubtemplate.load(“SubTemplatesConfig.xml”);

//**************************************************
//Function

function loadSubTemplate(){
var tempnew = importSubtemplate.firstChild;
var temp:Array = new Array();
for(i = 0; i<tempnew.childNodes.length; i++){
temp.push(tempnew.childNodes*.attributes.title);
}
return (temp);
}

Hi,
In this code the images are loading from the server thrugh the XML file into the movie clips
movie_mc.moviename0, movie_mc.moviename1, movie_mc.moviename2, etc.
I want to click on each item and at that time some action I have to write. Now I want like when I click on the first image a message with name of the first image comes like that.

but in my code
[COLOR=darkred]movie_mc.onRelease = function() {
trace(movie_mc[moviename]);
};[/COLOR]

–when click on any image the same message comes… please help.