Hi all,
I am pretty much a Flash nubie just forging my way through things. I am making a little drag and drop game where you click on a movieclip, which acts as a button. When the moviclip/button is clicked a duplicate of that same movieclip, only larger, is added to the stage. You then drag and drop it in a designated area on the stage.
I have that part of the code working fine. What I need is a reset button that removes the larger movieclip that was dragged. I am not sure how to do this.
Below is my code that is working fine. In the code I am the movieclip instance is named “myMC” and its class is “MyMC”.
myMC.addEventListener(MouseEvent.MOUSE_DOWN, moveMC);
function moveMC(e:MouseEvent){
var newMC:MyMC = new MyMC();
addChild(newMC);
newMC.width += 280;
newMC.height += 280;
newMC.x=myMC.x;
newMC.y=myMC.y;
newMC.addEventListener(MouseEvent.MOUSE_DOWN, dragMC)
newMC.addEventListener(MouseEvent.MOUSE_UP, dropMC)
}
function dragMC(e:MouseEvent){
e.currentTarget.startDrag();
}
function dropMC(e:MouseEvent){
e.currentTarget.stopDrag();
}
I tried removeChild for (myMC); and that removed everything. I only want to remove the second larger duplicate movieclip “newMC”.
Anyhelp would be greatly appreciated!