FR STAR FR STAR - 5 months ago 48
ActionScript Question

Flash as3 how stop playing child movie clips by mouse event?

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

however if I clicked the play button I put this one
. The issue is from
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 {

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 && != 'mc_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);

And then when you want to stop:

tempTimerCount += timer.currentCount;

And after start and you want to have the value of that timer you need to get the timer.currentCount + tempTimerCount;

Hope it helps.