# Actions only enabled on mouse over

**URL:** <https://forum.kirupa.com/t/actions-only-enabled-on-mouse-over/14948>\
**Category:** Uncategorized\
**Created:** [March 4, 2003, 7:30pm UTC](https://forum.kirupa.com/t/actions-only-enabled-on-mouse-over/14948 "2003-03-04T19:30:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagunco](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jagunco](https://forum.kirupa.com/u/jagunco)\
**Post date:** [March 4, 2003, 7:30pm UTC](https://forum.kirupa.com/t/actions-only-enabled-on-mouse-over/14948/1 "2003-03-04T19:30:27Z")

</div>

Hi there, I have a problem I can´t resolve, in the attached file there are 2 MC, I want to activate the ball\_mc only when I´m over other MC. I tried multiple things but I can´t manage to find what is the problem, can you of the gurus take a look at it please.

thanks

//jagunco boy

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 4, 2003, 10:49pm UTC](https://forum.kirupa.com/t/actions-only-enabled-on-mouse-over/14948/2 "2003-03-04T22:49:49Z")

</div>

I don’t understand your code:

```auto
meover.onEnterFrame = function() { // WHAT IS MEOVER??
	trace("olá");
	var acceleration = 10;
	var friction = .80;
	maxX = 760;
	minX = 0;
	ball_mc.moveToMouse = function() { // BAD IDEA TO DECLARE A FCT LIKE THAT
		var xdif = this.targetX-this._x;
		this.xspeed += xdif/this._parent.acceleration;
		this.xspeed *= this._parent.friction;
		this._x += this.xspeed;
		this.checkDistance();
	};
	ball_mc.checkDistance = function() {
		if (Math.abs(this.targetX-this._x)<0.2) {
			this._x = this.targetX;
		}
	};
	ball_mc.onMouseMove = function() {
		if ((_root._xmouse>=minX) && (_root._xmouse<=maxX)) {
			//trace("olá");
			this.targetX = this._parent._xmouse;
			this.onEnterFrame = this.moveToMouse;
		} else {
			this.targetX = this._parent._x;
		}
	};
};

```

Can you explain a bit?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 5, 2003, 8:22am UTC](https://forum.kirupa.com/t/actions-only-enabled-on-mouse-over/14948/3 "2003-03-05T08:22:56Z")

</div>

Hi there, I rebuild the file. I want to have the effect on the red square only happens when the mouse hits the blue square.

thanks for trying to help me

// jagunco
