Simple question coming up…
See attached .fla - how can I make the draggable MC ONLY draggable inside the “drag area” - so that it dossent’ cross the border of the “drag area”…?
Any help would be NICE!
Simple question coming up…
See attached .fla - how can I make the draggable MC ONLY draggable inside the “drag area” - so that it dossent’ cross the border of the “drag area”…?
Any help would be NICE!
Delete any code you have now, and place this code on the timeline containing the two movieclips. Then, give the box to be dragged the instance name ‘dragb’ and the area to drag in ‘darea’
MovieClip.prototype.keepInsideOf = function (boundary) {
if (this._x-this._width/2<boundary._x-boundary._width/2) {
this._x = boundary._x-boundary._width/2+this._width/2;
}
if (this._x+this._width/2>boundary._x+boundary._width/2) {
this._x = boundary._x+boundary._width/2-this._width/2;
}
if (this._y-this._height/2<boundary._y-boundary._height/2) {
this._y = boundary._y-boundary._height/2+this._height/2;
}
if (this._y+this._height/2>boundary._y+boundary._height/2) {
this._y = boundary._y+boundary._height/2-this._height/2;
}
};
dragb.onPress = function() {
this.onMouseMove = function() {
this._x = _root._xmouse;
this._y = _root._ymouse;
this.keepInsideOf(darea)
};
};
dragb.onRelease = dragb.onReleaseOutside=function () {
delete this.onMouseMove;
};
That is some nice coding dude - once again THX alot!
Can that you made jerry be used as masking any text added ? Some thing I would like to to try.
Regards Barrie.
It probably can. You need an example ?
Please Voetsjoeba I have seen it on some sites just dont know how to do it yet,
Regards Barrie.
Here’s an example:
Thankyou Voetsjoeba, I see you removed the grey box Jerry did! or did you? I was kinda thinking the grey box would be covering or uncovering the text, I will master that masking soon as I worked out how you did it Nice work.
Regards Barrie
:: Copyright KIRUPA 2024 //--