How do I remove a child from the stage using a button click?
I have a movieclip that requires Play, Pause, Forward and Back buttons. The movieclip has actionscript at various frames to load movieclips from the library and repeat them.
I have tried using a timeline scrubber but it does not trigger the actionscript when scrubbing, only when the movie plays normally.
My possible solution is to create Fwd and Back buttons that can go to specific frames where key animations will begin.
I need to develop actionscript that will remove Children when the user clicks Back.
This is how I am loading several movieclips along the timeline from my library:
var shpA1:arSHPp1;
function attachAR1 () {
shpA1 = new arSHPp1 ();
shpA1.x = -30;
shpA1.y = 18;
addChild (shpA1);
}
//the interval is used to repeat the animation to represent continuous flow on a diagram
var myInterval1:uint = setInterval (attachAR1, 500);
This what I have tried so far (not working at all - no errors or trace):
function remChild1(event:MouseEvent) :void {
if(shpA1.stage)
{
trace("arSHPp1 is in display list");
shpA1.parent.removeChild(shpA1);
shpA1 = null
}
else
{
trace("arSHPp1 isn't in display list");
}
