Search code examples
javascriptadobe-edge

Adobe Edge Javascript Loop from Start (with Symbols)


I am trying to get an adobe edge animation to loop from the start. Many tutorials and answers to this say use:

sym.play(0);

or, add a 'label' at the start and use:

sym.play("label");

However, this doesn't work for me.

After some digging, it appears that it may be because I am using 'symbols' (to group 4 different 'scenes' to keep everything organised).

The loop does seem to work if I use:

sym.getSymbol("Symbol1").play();

at the end of the timeline (end of Symbol4). However it will only jump to the start of Symbol1 and play just that one.

What I need is some code which will jump to the start of the timeline and play symbols1 through 4 on repeat forever.

(I tried also getting the stage like this:

sym.getComposition().getStage()

And playing using that, but to no avail) :(

Thanks


UPDATE:

This code seems to replay all, but it only does it one time (so the animation loops 2 times and then stops). Still not there yet! (also this is incredibly hacky!!!)

// Replay from the beginning, regardless of current playing state 
if (!sym.getSymbol("Symbol1").isPlaying() && 
    !sym.getSymbol("Symbol2").isPlaying() &&
    !sym.getSymbol("Symbol3").isPlaying() &&
    !sym.getSymbol("Symbol4").isPlaying()
) {
    sym.getSymbol("Symbol1").play(0);
    sym.getSymbol("Symbol2").play(0);
    sym.getSymbol("Symbol3").play(0);
    sym.getSymbol("Symbol4").play(0);
}

Solution

  • Figured it out. Add

    sym.playAll();
    

    To the 'complete' action to replay all symbols