# startDrag - constrain to rectangle

**URL:** <https://forum.kirupa.com/t/startdrag-constrain-to-rectangle/176562>\
**Category:** flash\
**Created:** [January 25, 2006, 1:47am UTC](https://forum.kirupa.com/t/startdrag-constrain-to-rectangle/176562 "2006-01-25T01:47:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dirksmith](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dirksmith](https://forum.kirupa.com/u/dirksmith)\
**Post date:** [January 25, 2006, 1:47am UTC](https://forum.kirupa.com/t/startdrag-constrain-to-rectangle/176562/1 "2006-01-25T01:47:28Z")

</div>

Hi

I have 9 images that are draggable on my screen - and when pressed become the top image- using the script below.

I’d also like to constrain to a rectangle (or coordinates) - ideally adapting the exisiting script and movie clip set-up.

Grateful for any ideas on achieving this.

Thanx

The script:

on (press) {

```
//Start Dragging Movieclip Behavior
startDrag(this);
this.swapDepths(this._parent.getNextHighestDepth());
//End Behavior

```

}  
on (release) {

```
//Stop Dragging Movieclip Behavior
stopDrag();
//End Behavior

```

}
