# Can you drag with easing?

**URL:** <https://forum.kirupa.com/t/can-you-drag-with-easing/14111>\
**Category:** Uncategorized\
**Created:** [February 21, 2003, 10:57pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111 "2003-02-21T22:57:50Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![georgia](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@georgia](https://forum.kirupa.com/u/georgia)\
**Post date:** [February 21, 2003, 10:57pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/1 "2003-02-21T22:57:50Z")

</div>

I have a button which is clicked and a second menu drops down. At that point, I have that second menu dragable along the x so that various buttons (there will be more) can be chosen.

My question is: is it possible to drag the menu with a smoother motion? Perhaps so that when the mouse is released, it eases to a stop? Is using drag the right way to go?  
[http://www3.sympatico.ca/stylusproductions/upload\_fla/button\_row.html](http://www3.sympatico.ca/stylusproductions/upload_fla/button_row.html)

(And only posting in one place )

Thanks,

georgia

---

<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:** [February 21, 2003, 11:08pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/2 "2003-02-21T23:08:39Z")

</div>

lol 😛 why have you deleted the other thread ?

ok … if i got your question:

place all the buttons in the submenu into a movie clip  
then just follow [this](http://www.kirupa.com/developer/mx/easing_mouseclick.htm) tutorial 🙂

hope it helps =)

---

<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:** [February 21, 2003, 11:24pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/3 "2003-02-21T23:24:42Z")

</div>

If the movie clips instance name was “box” then you would put this on a FRAME in the same timeline as the movie clip.

```php
box.onPress = function() {
	this.onEnterFrame = function() {
		endX = _root._xmouse;
		this._x += (_root._xmouse-this._x)/5;
	};
};
box.onRelease = _root.box.onReleaseOutside=function () {
	endX = _root._xmouse;
	this.onEnterFrame = function() {
		this._x += (endX-this._x)/5;
		if (this._x == endX) {
			delete this.onEnterFrame;
		}
	};
};

```

---

<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:** [February 22, 2003, 1:00am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/4 "2003-02-22T01:00:39Z")

</div>

Thank you lostinbeta, that code works great. Now I’m going to ask another question which I hope doesn’t sound too dense.

I went into my “clip2” which is the sliding bar. It is made up of the 4 movie clips. I selected the 222clip and gave it the action:

onClipEvent (mouseDown) {  
getURL(“[http://www.recipesplus.ca](http://www.recipesplus.ca)”, “\_blank”);  
}

Problem is, when I test the whole movie, the 222clip doesn’t react. Even after the drag is released, it still doesn’t work.

I’m sure this is a simple thing, sorry to ask such a “newbie” question.:-\

georgia

---

<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:** [February 22, 2003, 1:42am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/5 "2003-02-22T01:42:14Z")

</div>

Sorry, that was my mistake. I wasn’t thinking.

Try this method… I didn’t test it, but it should work.

```php
box.onEnterFrame = function() {
	if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
		this.onMouseDown = function() {
			this.onEnterFrame = function() {
				endX = _root._xmouse;
				this._x += (_root._xmouse-this._x)/5;
			};
		};
	} else {
		this.onMouseUp = function() {
			endX = _root._xmouse;
			this.onEnterFrame = function() {
				this._x += (endX-this._x)/5;
				if (this._x == endX) {
				}
			};
		};
	}
};

```

---

<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:** [February 22, 2003, 2:13am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/6 "2003-02-22T02:13:38Z")

</div>

Hey lostinbeta, thanks for taking the time with this.

Now the button is active, BUT that overrides the draging.:hair:

It seems to be either draging OR active buttons.

Thanks again,

georgia

---

<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:** [February 22, 2003, 4:45am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/7 "2003-02-22T04:45:00Z")

</div>

Alright, well as I said… it was untested. I will see if I can set up an example.

---

<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:** [February 22, 2003, 5:31am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/8 "2003-02-22T05:31:17Z")

</div>

Alright, I created this fully commented .fla file for you. I used a drag button instead of being the whole item draggable. It is more efficient/effective that way. All the code is in the slider MC. Enjoy 🙂

Oh yeah… note: I just realized I used movie clips as buttons (I have grown accustomed to it). This is NOT a necessity for the standard buttons, but it is a necessity for the drag button. The drag button MUST be a movie clip symbol, but the other buttons can be regular buttons symbols OR movie clips.

---

<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:** [February 22, 2003, 6:06am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/9 "2003-02-22T06:06:49Z")

</div>

You have been very kind. I’ll try it out and see what I can learn from it.

:beam:  
Thanks

Georgia

---

<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:** [February 22, 2003, 6:11am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/10 "2003-02-22T06:11:05Z")

</div>

No problem. It has been my pleasure 🙂 I hope you can learn a thing or two from that file 🙂

---

<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:** [February 22, 2003, 6:13am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/11 "2003-02-22T06:13:47Z")

</div>

I’m on a mac. I can’t download it:( ☹ ☹

Can you believe it?

georgia

---

<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:** [February 22, 2003, 6:20am UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/12 "2003-02-22T06:20:19Z")

</div>

If it saves it as a .php… just change the extension to .fla and it should work. Others have done that.

If not… try the .zip file.

---

<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:** [February 22, 2003, 3:20pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/13 "2003-02-22T15:20:59Z")

</div>

I went over the fla and learned much, thank you very, very much. My last question as it applies to the issue is:

Is it possible to have the whole sliding part made up of active buttons? Or then would it not be posible to drag?

georgia

---

<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:** [February 22, 2003, 5:35pm UTC](https://forum.kirupa.com/t/can-you-drag-with-easing/14111/14 "2003-02-22T17:35:50Z")

</div>

Well the problem with that method would be that your buttons are still clickable… so it will be easy to accidently click a wrong button. So I don’t recommend doing that at all, its not very functional.
