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?
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.
North America
Europe, Middle East and Africa
Asia Pacific