Drag and Drop Child Movieclip
Just trying to muddle through as3.
I am trying to implement a drag and drop feature that allows the user to the drag and drop multiple copies of the same movieclip leaving the orignial behind in the same position on the stage.
I have the code to create the drag and drop - how do I now do it so that it is the duplicate that is dragged in AS3
Code below:
////////////////////////////////////////
// Drag & Drop
//////////////////////////////////////
signRetirement.addEventListener(MouseEvent.MOUSE_D OWN, grabMe);
signRetirement.buttonMode = true;
var me:Object;
function grabMe(e:MouseEvent):void{
me = e.currentTarget;
me.removeEventListener(MouseEvent.MOUSE_DOWN, grabMe);
me.startDrag();
stage.addEventListener(MouseEvent.MOUSE_MOVE, dragMe);
stage.addEventListener(MouseEvent.MOUSE_UP, dropMe);
}
function dropMe(e:MouseEvent):void {
stage.removeEventListener(MouseEvent.MOUSE_UP, dropMe);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, dragMe);
me.stopDrag();
me.gotoAndStop(2);
me.addEventListener(MouseEvent.MOUSE_DOWN, grabMe);
}
function dragMe(e:MouseEvent):void {
e.updateAfterEvent();
}
|