I was thinking this is a simple task, but I\'m wrong.
I used a sprite to display an image, and when user drag it(MOUSE_DOWN and MOUSE_MOVE), I got the position in
You must use a high framerate to have smooth movement. The optimal framerate is 60fps because it is the default for most LCD monitors.
I don't have the code under my hand so I put the code here (not tested)
yourClip.addeventListenner(MouseEvent.MOUSE_DOWN, startDrag);
function startDrag(e:MouseEvent = null):void{
// record positon of the mouse relative to the clip
deltaX=stage.mouseX-yourClip.x;
deltaY=stage.mouseY-yourClip.y;
// attach on mouse move event
yourClip.addeventListenner(MouseEvent.MOUSE_MOVE, updateDrag);
// attach stop event (on Stage)
Stage.addeventListenner(MouseEvent.MOUSE_UP, stopDrag);
}
function updateDrag(e:MouseEvent = null):void{
yourClip.x=stage.mouseX-deltaX
yourClip.y=stage.mouseY-deltaY
}
function stopDrag(e:MouseEvent = null):void{
yourClip.removeEventListenner(MouseEvent.MOUSE_MOVE, updateDrag);
stage.removeEventListenner(MouseEvent.MOUSE_UP, stopDrag);
}