I would like to drag an object into one line. I already know how to do this in a horizontal or vertical line
This is how i do it
private var handle:Sprite;
private function init():void
{
handle = new Sprite();
handle.mouseChildren = false;
handle.buttonMode = true;
handle.graphics.beginFill(0xFF0000);
handle.graphics.drawCircle(0, 0, 5);
handle.addEventListener(MouseEvent.MOUSE_DOWN, startMove);
handle.addEventListener(MouseEvent.MOUSE_UP, stopMove);
}
private function startMove(evt:MouseEvent):void
{
var bounds:Rectangle = new Rectangle(0, 0, 100, 1);
handle.startDrag(false, bounds);
}
private function stopMove(evt:MouseEvent):void
{
handle.stopDrag();
}
But I want to drag my object into a row that is not horizontal or vertical. For example, I would like to drag an object from the upper left corner to the lower right corner, in a straight line.
I tried to rotate the rectangle of borders, but it seems that you cannot rotate the rectangle.
How to drag an object in a non-vertical (or non-horizontal) row?
Many thanks!
Vincent
source
share