Skip to main content
Known Participant
May 19, 2010
Question

Remove after event?

  • May 19, 2010
  • 1 reply
  • 403 views

I am assuming I should be using the onEvent Completion to handle this, but not sure the approach.

Essentially, I have an added movieclip on a click, that then plays through "pop" inside that mc. Now, when I click the close button (added on top of the MC added), it plays through "drop"

My question is, how would I remove that mc AFTER it has played through the "drop" label? My code is below:

stop();

btn_aboH.addEventListener (MouseEvent.CLICK, aboPop);

function aboPop (e:MouseEvent):void{
    mc_ppop.gotoAndPlay ("pop");
   
    addChild (mc_ppop);
    mc_ppop.x = 100;
    mc_ppop.y = 350;
   
    addChild (btn_close);
    btn_close.x = 500;
    btn_close.y = 651.4;
    btn_close.buttonMode = true;
   
    btn_close.addEventListener (MouseEvent.CLICK, closeAbo);
}


function closeAbo (e:MouseEvent):void{
    mc_ppop.gotoAndPlay ("drop");
    removeChild (btn_close);
    btn_close.removeEventListener (MouseEvent.CLICK, closeAbo);
}

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 19, 2010

add to the last frame in your "drop" sequence:

this.parent.removeChild(this);