# Constrain x movement

**URL:** <https://forum.kirupa.com/t/constrain-x-movement/118251>\
**Category:** Uncategorized\
**Created:** [August 4, 2004, 1:00am UTC](https://forum.kirupa.com/t/constrain-x-movement/118251 "2004-08-04T01:00:07Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![pom](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pom](https://forum.kirupa.com/u/pom)\
**Post date:** [August 6, 2004, 9:50am UTC](https://forum.kirupa.com/t/constrain-x-movement/118251/8 "2004-08-06T09:50:25Z")

</div>

> [@jmzx](#):
>
> 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;  
> }  
> }

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:

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

```

Is that what you’re trying to do?

---

_[View the full topic](https://forum.kirupa.com/t/constrain-x-movement/118251)._
