I'm having same issue exactly explained in this forum post How to stop all child movieclips inside a movieclip in AS3?
Except my requirement is When user click the pause button current frame holding movie clip child element should gotoAndStop and 25 frame.
Also I'm using a timer function so when user click pause button timer should be stopped. This actually working when I add the following code myTimer.stop();
however if I clicked the play button I put this one myTimer.start();
. The issue is from myTimer.start();
function it's actually starting the timer all over again but I need to resume the timer.
Could any help me out of these issues. ASAP
To stop all your child movieclips you could use the code provided in that answer you linked to in your question:
yourButton.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void {
stopAllClips(yourMovieClip);
}
function stopAllClips(mc:MovieClip):void
{
var n:int = mc.numChildren;
for (var i:int=0;i<n;i++)
{
var clip:MovieClip = mc.getChildAt(i) as MovieClip;
if (clip && clip.name != 'mc_2')
clip.gotoAndStop(2);
}
}
In order to 'resume` your timer you need to keep a variable so you can 'resume' again. Something like this:
var tempTimerCount:int = 0;
var timer:Timer = new Timer(1000);
timer.start();
And then when you want to stop:
tempTimerCount += timer.currentCount;
timer.stop();
And after start and you want to have the value of that timer you need to get the timer.currentCount + tempTimerCount
;
Hope it helps.