3 Replies Latest reply: May 3, 2012 12:16 PM by Ned Murphy RSS

    How do you remove a movie clip from the stage via a dispatch event?

    Mr. Baker the Shoe Maker Community Member

      I have a movie clip that is added to the stage. There is a close button on that movie clip that I would like to close and remove the clip from the stage. But the close button does not work when it is clicked, nothing happens.


      Here's the flow along with the code:


      //Adds the movie clip to the stage

      var myPlayCredits:mc_playCredits = new mc_playCredits();


      stage.addEventListener(MouseEvent.MOUSE_DOWN, goButtons);

      function goButtons(event:MouseEvent):void


          if (event.target == Credits_bnt)




              myPlayCredits.x = 511;

              myPlayCredits.y = 386;




      //This is the code on the button inside the movie clip that calls the dispatch

      import flash.events.Event;


      closeCredit.addEventListener(MouseEvent.MOUSE_DOWN, closeCreditPopupScreen);

      function closeCreditPopupScreen (event:MouseEvent):void


            dispatchEvent(new Event("RemoveMCcredit"));





      //Removes (is supposed to remove) the MovieClip from the stage when the user clicks on the close button inside the MovieClip.

      stage.addEventListener("RemoveMCcredit", RemoveCreditClip);

      function RemoveCreditClip(e:Event):void





      Anybody have any thoughts?