# Rollovers on dynamically loaded images

**URL:** <https://forum.kirupa.com/t/rollovers-on-dynamically-loaded-images/210856>\
**Category:** flash\
**Created:** [December 22, 2006, 10:18pm UTC](https://forum.kirupa.com/t/rollovers-on-dynamically-loaded-images/210856 "2006-12-22T22:18:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NHansen](https://avatars.discourse-cdn.com/v4/letter/n/f08c70/32.png) [@NHansen](https://forum.kirupa.com/u/NHansen)\
**Post date:** [December 22, 2006, 10:18pm UTC](https://forum.kirupa.com/t/rollovers-on-dynamically-loaded-images/210856/1 "2006-12-22T22:18:35Z")

</div>

For the life of me, I cannot get any rollovers to work with the images that have been loaded from XML. I can target them and set the \_alpha and whatnot, but rollover/out/press functions don’t seem to work :[  
I’ve tried many different ways… does anyone see what’s wrong?

```auto

function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
title = [];
type1 = [];
type2 = [];
type3 = [];
ypos = [];
total = xmlNode.childNodes.length;
//////////
for (i=0; i<total; i++) {
ypos* = (135 * i) + 225;
title* = xmlNode.childNodes*.childNodes[0].childNodes[0].nodeValue;
image* = xmlNode.childNodes*.childNodes[1].childNodes[0].nodeValue;
type1* = xmlNode.childNodes*.childNodes[2].childNodes[0].nodeValue;
type2* = xmlNode.childNodes*.childNodes[3].childNodes[0].nodeValue;
type3* = xmlNode.childNodes*.childNodes[4].childNodes[0].nodeValue;
//////////
///create thumbs
var thumb_mc:MovieClip = _root.main.createEmptyMovieClip("thumb"+ (1 + i), _root.main.getNextHighestDepth());
thumb_mc._x = 0;
thumb_mc._y = ypos*;
loadMovie (image * , thumb_mc);

//////////////////////////////////////////////////////////////////////
///////////////////////////////FUNCTION////////////////////////////
//////////////////////////////////////////////////////////////////////

thumb_mc.onRollOver = function () { 
trace("YUP-over"); //should work 
} 
thumb_mc.onRollOut = function () { 
trace("YUP-out"); //should work 
}

//////////////////////////////////////////////////////////////////////
///////////////////////////////FUNCTION////////////////////////////
//////////////////////////////////////////////////////////////////////

}

} else {
content = "file not loaded!";
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("data.xml");
///////////////////////////////////// 

```

THANK YOU for your help.
