# startDrag bounds

**URL:** <https://forum.kirupa.com/t/startdrag-bounds/265620>\
**Category:** flash\
**Created:** [July 10, 2008, 7:33pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620 "2008-07-10T19:33:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [July 10, 2008, 7:33pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620/1 "2008-07-10T19:33:27Z")

</div>

So I’m doing what I would normally do in AS 2 and it’s not working. On press of my clip I am getting

```auto

Argument count mismatch on flash.display::Sprite/startDrag(). Expected 0, got 6;

```

Live docs don’t have an example on how to set bounds.

Does startDrag not take any parameters?

Any links or anything?

TIA

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [July 10, 2008, 7:36pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620/2 "2008-07-10T19:36:15Z")

</div>

```auto

public function startDrag(lockCenter:Boolean = false, bounds:Rectangle = null)

```

so essentially you pass a boolean for lockcenter and a flash.geom.Rectangle containing bounds.

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [July 10, 2008, 8:32pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620/3 "2008-07-10T20:32:52Z")

</div>

Could you expand on that a little more please?

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [July 10, 2008, 8:50pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620/4 "2008-07-10T20:50:21Z")

</div>

Sure thing.

Basically ‘startDrag’ expects 2 arguments now. Lockcenter, which is default to false. Lockcenter specifies if the object should be locked to the center of the mouse position (true) or to the point where you click the sprite (false)

After that it wants a rectangle to define it’s bounds. A rectangle is basically just an Object that looks like this;  
{xmin:0, ymin:0, xmax:200, ymax:200}

Like this; var \_bounds = new Rectangle(0, 0, 200, 200)

After that you just pass it to the startDrag like (false, \_bounds)

I uploaded a quick example you can check out if you like

[www.erikhallander.com/junk/Digi.zip](http://www.erikhallander.com/junk/Digi.zip)

---

<div class="post-metadata">

**Author:** ![Digitalosophy](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/digitalosophy/32/1114_2.png) [@Digitalosophy](https://forum.kirupa.com/u/Digitalosophy)\
**Post date:** [July 10, 2008, 9:52pm UTC](https://forum.kirupa.com/t/startdrag-bounds/265620/5 "2008-07-10T21:52:35Z")

</div>

Thanks man 🙂

[quote=sekasi;2356485]Sure thing.

Basically ‘startDrag’ expects 2 arguments now. Lockcenter, which is default to false. Lockcenter specifies if the object should be locked to the center of the mouse position (true) or to the point where you click the sprite (false)

After that it wants a rectangle to define it’s bounds. A rectangle is basically just an Object that looks like this;  
{xmin:0, ymin:0, xmax:200, ymax:200}

Like this; var \_bounds = new Rectangle(0, 0, 200, 200)

After that you just pass it to the startDrag like (false, \_bounds)

I uploaded a quick example you can check out if you like

[www.erikhallander.com/junk/Digi.zip](http://www.erikhallander.com/junk/Digi.zip)[/quote]
