# Xml menu: onrollover declared in loop not working

**URL:** <https://forum.kirupa.com/t/xml-menu-onrollover-declared-in-loop-not-working/101413>\
**Category:** Uncategorized\
**Created:** [February 9, 2004, 8:20pm UTC](https://forum.kirupa.com/t/xml-menu-onrollover-declared-in-loop-not-working/101413 "2004-02-09T20:20:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flashmatazz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/flashmatazz/32/140_2.png) [@Flashmatazz](https://forum.kirupa.com/u/Flashmatazz)\
**Post date:** [February 9, 2004, 8:20pm UTC](https://forum.kirupa.com/t/xml-menu-onrollover-declared-in-loop-not-working/101413/1 "2004-02-09T20:20:20Z")

</div>

Can somebody please help me with the following 'cause I’m confuesd, or overlooking something completely…

I’m building a small XML menu where I want to call a function for each subitem’s onrollover

part of my code:

[AS]  
//\*\*\* build submenu items \*\*\*\*  
for (j=0; j\< numSubItems; j++){  
curSubItemName = my\_XML.firstChild.childNodes\*.childNodes[j].firstChild.nodeValue;  
curSubItem = _root[“item”+i].createEmptyMovieClip("subItem_"+i+"\_"+j, myDepth);  
curSubItem.\_y = (j+1)\*-spacing;  
myDepth++;  
curSubItem.onRollOver = function(){  
this.subHighLight();  
}  
}   
[/AS]  
and the subHighLight function for now just looks like this:  
[AS]  
MovieClip.prototype.subHighLight = function(){  
trace(“test”);  
};  
[/AS]

The menu gets populated from the XML file, no problem. However, the onRollOver simply isn’t working, but why???

Thanks.
