PDA

View Full Version : [AS3] startdrag constraint issue


zzxjoanw
12-05-2010, 05:06 PM
I have the following code:

current = this[event.target.name];
current.startDrag(true,new Rectangle(current.width/2,
current.height/2,
stage.stageWidth-current.width/2,
stage.stageHeight-current.height/2));
The problem I'm having is that the objects aren't stopping at the stage borders. I'm sure I'm missing something obvious, but I'm at my wit's end.

Any help would be appreciated.

rrh
12-06-2010, 09:03 PM
The last two parameters of the Rectangle aren't the right and bottom co-ordinates, but the width and height. So it would be -current.width not -current.width/2