# Stop drag in a certain space

**URL:** https://forum.kirupa.com/t/stop-drag-in-a-certain-space/145942
**Category:** Uncategorized
**Created:** [April 27, 2005, 2:57am UTC](https://forum.kirupa.com/t/stop-drag-in-a-certain-space/145942 "2005-04-27T02:57:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![devil\_online](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/devil_online/32/1121_2.png) [@devil\_online](https://forum.kirupa.com/u/devil_online)
#### Post date: [April 27, 2005, 2:57am UTC](https://forum.kirupa.com/t/stop-drag-in-a-certain-space/145942/1 "2005-04-27T02:57:41Z")

</div>

I have a MC that drags and when I release it return to the inicial place.  
Now it’s possible to make it stop drag normally, but only in a small part of the flash movie.

For exemple in a sqare it stops drag normally…  
is that possible?

I use this code:

```auto
 
onClipEvent (load) {
origX = this._x;
origY = this._y;
}
onClipEvent (mouseDown) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.startDrag();
}
}
onClipEvent (mouseUp) {
if (this.hitTest(_parent._xmouse, _parent._ymouse)) {
this.stopDrag();
this._x = origX;
this._y = origY;
}
}

```

thanks
