Constrain x movement

first my actionscript still sux… so any help pls :wink:

i have this script attatched to the object i want to move with mouse…
only i want to constrain the x movement to another object in the same timeline… i’ve been able to find lots of stuff related to dragging, but how to apply constraints without drag function?

onClipEvent (enterFrame) {
this._x = _root.xvalue=_root._xmouse;
}


onClipEvent (enterFrame) {
	if (this._x > max._x) {
		this._x = max._x;
	}
}

I think

yep cheers Vinc3 your a * … james

hmmm still no joy, what something like this?

onClipEvent (enterFrame) {
this._x = _root.xvalue=_root._xmouse;
}
onClipEvent (enterFrame) {
if (this._x=_root.site.box) {
this._x = max._x;
}
}

I’m a what?

a star… -> * you know… little pointy thing (for helping).

sorry for confuzion, brain melting… aghhhhh! still need your help

what’s wrong this time?

You can’t declare multiple onClipEvent (enterFrame) event handlers without overwriting them.

I’m not sure I understand what you’re trying to do. If you want to be able to drag your clip up to the position of another clip, you could do it like that:

onClipEvent (enterFrame) {
	this._y = _root._ymouse ;
	this._x = Math.min (_root._xmouse, _root.site.box._x) ;
}

Is that what you’re trying to do?

I picked that up too, but I didn’t know it was a major prob…hehe

PS: Hello, Ilyas le G(r)eek :stuck_out_tongue:

‘’’ thanx both for explaining that you can’t declare multiple event handlers. ‘’’

… perhaps if i explain my objectives better than before…

i want to move one clip by the x (<->) movement of the mouse.
and constrain the movement of that clip, to the x (<->width) of another clip.

‘’’ silly of me not to make that clear in the first place,
tired, not even sure what i’m doing myself, but thanx guys ‘’’ James

Key Movement: http://www.kirupa.com/developer/mx/movement_keys.htm

to constrain, is like what i said before (-:

or what Ilyas le G®eek said