Bin icon deletes an Movieclip
Hi all
I got sort o stuck with a simple interaction I'm trying to do... Hope somebody can help me out
I have a button that everytime it is clicked, creates an instance of a MovieClip, puts it in an array and display it on screen
menu_event.addEventListener(MouseEvent.CLICK, clickHandler);
function newMcEvent():void
{
var clip:MovieClip = new mc_event(); //mc_event is the name of the Mc in the library
addChild(clip);
clip.x = 50;
clip.y = 350;
eventArray.push(clip);
trace(eventArray+clip.name);//this will show the array list plus the name of the last in, just for feedback
}
Keep in mind that the mc_event movieClip is draggable...
On stage I also have movieClip called bin which should delete whatever clip i'm dragging on it. The simplest I guess would be to have a function that says:
If mouse.target hits the bin, then removeChild(mouse.target)
Does it make sense?
here is may failed chink of code for the above
bin.addEventListener(MouseEvent.CLICK, hit);
function hit(event:MouseEvent):void{
if(event.currentTarget.hitTestObject(bin)){
bin.myText.text = "ok";
}
}