# Problem Controlling the movement of MC on RollOver

**URL:** <https://forum.kirupa.com/t/problem-controlling-the-movement-of-mc-on-rollover/170604>\
**Category:** flash\
**Created:** [November 28, 2005, 1:43am UTC](https://forum.kirupa.com/t/problem-controlling-the-movement-of-mc-on-rollover/170604 "2005-11-28T01:43:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CayoHueso](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@CayoHueso](https://forum.kirupa.com/u/CayoHueso)\
**Post date:** [November 28, 2005, 1:43am UTC](https://forum.kirupa.com/t/problem-controlling-the-movement-of-mc-on-rollover/170604/1 "2005-11-28T01:43:35Z")

</div>

Hi, I have the code below to control a movieclip that will move in one direction when the user rolls over it, and will move back when the user rolls out of the mc.

I created two functions to give a delay in the movement, but when I move the cursor on rollover and rollout fast and repeated, the movie goes out of control and start moving back and forward.

Here is a FLA of what I am trying to do.

[http://www.dyangochavez.com/offline/test2.fla](http://www.dyangochavez.com/offline/test2.fla)

Can anyone give me any suggestions on how to solve this?  
Thanks a lot

\*\*

```auto

**import mx.transitions.Tween;
import mx.transitions.easing.*;

var infoInt;
var infoInt2;
var count = 0;
var count2=0;
function showInfo () {
	if (count == 5) {
		clearInterval (infoInt);
		clearInterval (infoInt2);
		count = 0;
		var infoT:Tween = new Tween (info_mc, "_y", Strong.easeOut, 285, 66, 2, true);
	} else {
		count++;
	}
}
//
function hideInfo () {
	if (count2== 5) {
		clearInterval (infoInt);
		clearInterval (infoInt2);
		count2= 0;
		var infoTback:Tween = new Tween (info_mc, "_y", Strong.easeOut, 66, 285, 2, true);
	} else {
		count2++;
	}
}
//
info_mc.onRollOver = function () {
	infoInt = setInterval (showInfo, 100);
};
info_mc.onRollOut = function () {
	infoInt2 = setInterval (hideInfo, 100);
};

```
