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);