Gabriel Meono
Gabriel Meono

Reputation: 1000

AS3 Replay movie including symbols?

I happen to have lots symbols with timelines, if I gotoAndPlay frame 1 from scene 1, most symbols won't play like they did on the first time.

I use

MovieClip(root).gotoAndPlay("one");

Upvotes: 0

Views: 381

Answers (1)

felipemaia
felipemaia

Reputation: 3571

The reason they're not playing is due to the fact that they have their own timeline, if you want every single one of your MovieClip to play, use the following function:

function playEverything(disp : DisplayObjectContainer, frame : int = 1) : void
{
    if(disp is MovieClip)
    {
        MovieClip(disp).gotoAndPlay(frame);
    }
    for(var i : int = 0; i < disp.numChildren; i++)
    {
        var child : DisplayObject = disp.getChildAt(i);
        if(child is DisplayObjectContainer)
        {
            playEverything(DisplayObjectContainer(child), frame);
        }
    }
}

Then to play everything, do playEverything(stage);

Upvotes: 1

Related Questions