Skip navigation
Currently Being Moderated

Remove attached clip and go to a frame on a main movie

Aug 9, 2012 12:35 PM

Tags: #remove #clip #attached

I am attaching a Movie Clip on a Main movie wthi sthis:

 

exit_btn.addEventListener(MouseEvent.CLICK, fexit, false, 0, true);

function fexit(e:MouseEvent):void{

    var mc:alert_mc=new alert_mc();

    mc.x=320;

    mc.y=210;

    addChild(mc);

}

 

I need to make the Main movie go to frame 6 and remove the attached clip when I click on yep_btn button. The code on the attached clip is:

 

nope_btn.addEventListener(MouseEvent.CLICK, cancelunloadexitb);

yep_btn.addEventListener(MouseEvent.CLICK, unloadexitb);

 

 

function cancelunloadexitb(e:MouseEvent):void {

    var snd:sound1 = new sound1();

    snd.play();

    this.parent.removeChild(this);

}

 

function unloadexitb(e:MouseEvent):void {

     var snd:sound1 = new sound1();

    snd.play();

    I NEED CODE HERE

}

 

function errorF(e:IOErrorEvent):void{

 

trace(e);

 

}

 

Any ideas?

 
Replies
  • Currently Being Moderated
    Aug 9, 2012 1:03 PM   in reply to edwinmerced

    If that code is inside the alert_mc object, then you can try...

     

    function unloadexitb(e:MouseEvent):void {

         var snd:sound1 = new sound1();

        snd.play();

        MovieClip(parent).gotoAndStop(6);

        MovieClip(parent).removeChild(this);

    }

     

    Another way to do it would be to just have the alert_mc dispatch an event that you assign a listener for in the main, and have the main event handler function for that listener deal with removing the child and moving on its own timeline.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 9, 2012 1:37 PM   in reply to edwinmerced

    You're welcome

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points