Can you drag with easing?

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

(And only posting in one place )

Thanks,

georgia

lol :stuck_out_tongue: 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 tutorial :slight_smile:

hope it helps =)

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

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;
		}
	};
};

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”, “_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

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

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

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) {
				}
			};
		};
	}
};

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

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

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 :slight_smile:

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.

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

:beam:
Thanks

Georgia

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

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

Can you believe it?

georgia

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.

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

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.