Drag an item to the "trash"??
I have an application with a custom class that gets added to the stage.
I am trying to wired up a way for the user to "delete" the added objects (s)he
doesn't want anymore. I was thinking of dragging it to a "trash can" area,
and then detect the collision and "delete" it with my deleteMe method. See
code for the methods in this object so far:
private function dragMe(e:MouseEvent):void {
this.startDrag();
this.alpha = .5;
}
private function dropMe(e:MouseEvent):void {
this.stopDrag();
this.alpha = 1;
}
private function clickedMe(e:MouseEvent):void {
parent.setChildIndex(this, parent.numChildren-1);
clickSound.play();
}
private function deleteMe():void {
parent.removeChild(this);
}
|