hi, I am comming with simple easy way to drag and drop of flash as3. I have use startDrag and stopDrag to drag and drop movieClip or any display Object. But it gives some disturbe . So, made tiny but flexible to drag and drop your object.

import flash.ui.Mouse;

function startDragging(event:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE,moveBall);
}

function moveBall(event:MouseEvent):void{
circle.x=event.stageX-circle.width/2;
circle.y=event.stageY-circle.height/2;

}

function stopDragging(event:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE,moveBall);
}

circle.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
circle.addEventListener(MouseEvent.MOUSE_UP,stopDragging);

Note : here circle is the movieclip

Advertisements