I have a button inside a MC, and I’m trying to get it so if you pull it out a certain distance, it eases a menu out, but if it’s not out far enough it eases back in, the same, but in reverse when trying to close the menu…the code I have seems to work, but it opens when you click it first, without dragging it past the point where it has to be to fully open…hope that’s not too confusing the code it this:
_root.dragMenu.dragBut.onPress = function() {
startDrag(this._parent, false, 645, 370, 720, 370);
};
_root.dragMenu.dragBut.onRelease = function() {
trace(this._parent._x);
noBut();//disables the button while in motion
if (_global.opening == 1) {
_global.opening = 0;
} else {
_global.opening = 1;
}
if (this._parent._x>=655 && _global.opening == 1) {
this._parent.easeX(720);
} else {
this._parent.easeX(645);
}
if (this._parent._x<=715 && _global.opening != 1) {
this._parent.easeX(645);
} else {
this._parent.easeX(720);
}
stopDrag();
};
it drags from 645 to 720 in total…not a lot of room to play with either
if anyone has any ideas, I’d be very appreciative…thanks
**and a very big thanks to Voets, for his golden formula
Adam