View Full Version : can you drag with easing?
georgia
February 21st, 2003, 05:57 PM
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
kode
February 21st, 2003, 06:08 PM
lol :P 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 =)
lostinbeta
February 21st, 2003, 06:24 PM
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;
}
};
};
georgia
February 21st, 2003, 08:00 PM
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
lostinbeta
February 21st, 2003, 08:42 PM
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) {
}
};
};
}
};
georgia
February 21st, 2003, 09:13 PM
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
lostinbeta
February 21st, 2003, 11:45 PM
Alright, well as I said... it was untested. I will see if I can set up an example.
lostinbeta
February 22nd, 2003, 12:31 AM
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.
georgia
February 22nd, 2003, 01:06 AM
You have been very kind. I'll try it out and see what I can learn from it.
:beam:
Thanks
Georgia
lostinbeta
February 22nd, 2003, 01:11 AM
No problem. It has been my pleasure :) I hope you can learn a thing or two from that file :)
georgia
February 22nd, 2003, 01:13 AM
I'm on a mac. I can't download it:( :( :(
Can you believe it?
georgia
lostinbeta
February 22nd, 2003, 01:20 AM
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.
georgia
February 22nd, 2003, 10:20 AM
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
lostinbeta
February 22nd, 2003, 12:35 PM
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.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.