# Nesting problem

**URL:** <https://forum.kirupa.com/t/nesting-problem/141730>\
**Category:** Uncategorized\
**Created:** [March 22, 2005, 6:15pm UTC](https://forum.kirupa.com/t/nesting-problem/141730 "2005-03-22T18:15:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![macneilslt](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@macneilslt](https://forum.kirupa.com/u/macneilslt)\
**Post date:** [March 22, 2005, 6:15pm UTC](https://forum.kirupa.com/t/nesting-problem/141730/1 "2005-03-22T18:15:01Z")

</div>

I have animated buttons with an over and out state, but I want to have button movieclips with in the main button so I can’t use onRollOver/onRollout to go to the over and out states…so I came up with this…there is 4 buttons…

```auto

numB = 4;
for (i=1; i<=numB; i++) {
	var but = this["b"+i];
	but.onMouseMove = function() {
		if (this._currentframe == 1 && this._currentframe != 25 && this.hitTest(_root._xmouse, _root._ymouse, true)) {
			this.gotoAndPlay("over");
		} else {
			if (this._currentframe == 25 && this.hitTest(_root._xmouse, _root._ymouse, false)) {
				this.gotoAndPlay("out");
			}
		}
	};
}

```

the problem is, I don’t want it to play the “out” animation of the button if the mouse is still touching it, so I wanted to check if the mouse was still touching it, if the mouse was still touching it…then it wouldn’t play the "out’…

this is how it is now:  
[http://www.falloutbmx.com/test/testNavigation.html](http://www.falloutbmx.com/test/testNavigation.html)

this is how I want it to work:  
[http://www.falloutbmx.com/test/testNavigationRollOver.html](http://www.falloutbmx.com/test/testNavigationRollOver.html)

any suggestions?
