dragdrop
/**
* Copyright kazuyuki ( http://wonderfl.net/user/kazuyuki )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/xVxW
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
public class DragDrop extends Sprite {
public function DragDrop() {
var circle:Sprite = new Sprite();
circle.graphics.beginFill(0xff5500);
circle.graphics.drawCircle(0,0,50);
circle.graphics.endFill();
circle.x = (stage.stageWidth/2);
circle.y = (stage.stageHeight/2);
addChild(circle);
circle.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
circle.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
}
private function mouseDown(e:MouseEvent):void{
e.currentTarget.startDrag();
}
private function mouseUp(e:MouseEvent):void{
e.currentTarget.stopDrag();
}
}
}