Problem
Need drag and drop movie clip + separate code from .fla file to .as file.
Solution
Using startDrag/stopDrag, and addEventListener/removeEventListener.
Detailed explanation
package {
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class DragDrop extends MovieClip {
function DragDrop() {
trace("class DragDrop working");
this.addEventListener(MouseEvent.MOUSE_DOWN,
dragFlower);
this.buttonMode=true;
}
function dragFlower(event:MouseEvent):void {
trace("starting dragFlower working");
this.startDrag();
this.addEventListener(MouseEvent.MOUSE_UP, dropFlower);
}
function dropFlower(event:MouseEvent):void {
trace("dropFlower working too");
this.stopDrag();
this.removeEventListener(MouseEvent.MOUSE_UP,
dropFlower);
}
}
}


Source:
drag_and_drop_movie_clip
