# "ease on mouse click" help

**URL:** https://forum.kirupa.com/t/ease-on-mouse-click-help/21366
**Category:** flash
**Created:** [May 20, 2003, 10:50pm UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366 "2003-05-20T22:50:21Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![holy\_cheese](https://avatars.discourse-cdn.com/v4/letter/h/f6c823/32.png) [@holy\_cheese](https://forum.kirupa.com/u/holy_cheese)
#### Post date: [May 20, 2003, 10:50pm UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/1 "2003-05-20T22:50:21Z")

</div>

this regards the tutorial on “easing on mousae click” i can make it but i was wondering how i were to give it boundaries if i made it in a lrager set, but did not want it able to move around the entire frame, only in a designated area

---

<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: [May 20, 2003, 11:14pm UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/2 "2003-05-20T23:14:24Z")

</div>

you need something like this :):

```auto
// declaring object to store data
boundaries = {};
// right boundary
boundaries.r = 100;
// top boundary
boundaries.t = 0;
// left boundary
boundaries.l = 0;
// bottom boundary
boundaries.b = 100;
MovieClip.prototype.easeMC = function(x, y, easingFactor) {
	this.onEnterFrame = function() {
		tempX=this._x, tempY=this._y;
		if (x>boundaries.l && y>boundaries.t && x<boundaries.r && y<boundaries.b) {
			if (differenceX>0 || differenceY>0) {
				this._x += differenceX/easingFactor;
				this._y += differenceY/easingFactor;
			} else {
				delete this.onEnterFrame;
			}
		} else {
			delete this.onEnterFrame;
		}
	};
};
/* usage */
onMouseDown = function () {
	mymovieclip.easeMC(_xmouse, _ymouse, 25);
};

```

I was trying to make so that the mc moves as far as i can within the boundaries when the mouse is clicked outside of it, but there was a little bug i couldnt overcome ;(

---

<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: [May 21, 2003, 3:42am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/3 "2003-05-21T03:42:14Z")

</div>

thanx heaps

---

<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: [May 21, 2003, 3:56am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/4 "2003-05-21T03:56:16Z")

</div>

wait wait wait  
\>\_\<  
was that for a box? or do i have to make the box a movie clip???i.e i want to draw a box, just a square oneand make it so the dot cannot move out of the box and so that it doesn’t respond to a click outside the box

---

<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: [May 21, 2003, 8:08am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/5 "2003-05-21T08:08:12Z")

</div>

```auto
// right boundary
boundaries.r = 100;
// top boundary
boundaries.t = 0;
// left boundary
boundaries.l = 0;
// bottom boundary
boundaries.b = 100;

```

this is where the dimensions/position of the ‘box’ go… 🙂

---

<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: [May 22, 2003, 2:59am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/6 "2003-05-22T02:59:44Z")

</div>

🙂 shibby.  
thanx heaps

---

<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: [May 22, 2003, 3:17am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/7 "2003-05-22T03:17:00Z")

</div>

wait, stop again.  
i put the original movement code on the mc and ur code on the frame…  
the boundaries dont werk

---

<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: [May 22, 2003, 3:44am UTC](https://forum.kirupa.com/t/ease-on-mouse-click-help/21366/8 "2003-05-22T03:44:00Z")

</div>

you don’t use the original code anymore.

just replace mymovieclip in this line of the code with the actual instance name of your movieclip. 😉

```auto
onMouseDown = function () {
        **mymovieclip**.easeMC(_xmouse, _ymouse, 25);
};

```
