this regards the tutorial on “easing on mousae click” i can make it but i was wondering how i were to give it boundaries if i made it in a lrager set, but did not want it able to move around the entire frame, only in a designated area
you need something like this :):
// declaring object to store data
boundaries = {};
// right boundary
boundaries.r = 100;
// top boundary
boundaries.t = 0;
// left boundary
boundaries.l = 0;
// bottom boundary
boundaries.b = 100;
MovieClip.prototype.easeMC = function(x, y, easingFactor) {
this.onEnterFrame = function() {
tempX=this._x, tempY=this._y;
if (x>boundaries.l && y>boundaries.t && x<boundaries.r && y<boundaries.b) {
if (differenceX>0 || differenceY>0) {
this._x += differenceX/easingFactor;
this._y += differenceY/easingFactor;
} else {
delete this.onEnterFrame;
}
} else {
delete this.onEnterFrame;
}
};
};
/* usage */
onMouseDown = function () {
mymovieclip.easeMC(_xmouse, _ymouse, 25);
};
I was trying to make so that the mc moves as far as i can within the boundaries when the mouse is clicked outside of it, but there was a little bug i couldnt overcome ;(
thanx heaps
wait wait wait
>_<
was that for a box? or do i have to make the box a movie clip???i.e i want to draw a box, just a square oneand make it so the dot cannot move out of the box and so that it doesn’t respond to a click outside the box
// right boundary
boundaries.r = 100;
// top boundary
boundaries.t = 0;
// left boundary
boundaries.l = 0;
// bottom boundary
boundaries.b = 100;
this is where the dimensions/position of the ‘box’ go…
shibby.
thanx heaps
wait, stop again.
i put the original movement code on the mc and ur code on the frame…
the boundaries dont werk
you don’t use the original code anymore.
just replace mymovieclip in this line of the code with the actual instance name of your movieclip.
onMouseDown = function () {
**mymovieclip**.easeMC(_xmouse, _ymouse, 25);
};