startDrag bounds

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


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


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

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

Could you expand on that a little more please?

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

Thanks man :slight_smile:

[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[/quote]