Adobe Edge how to disable auto play by code?

601 views Asked by At

I have an Adobe Edge animation that is playing automatically by default.

Is there a way to disable or prevent the auto play by javascript code?

For example by passing some option when loading the composition with AdobeEdge.loadComposition() or by setting some event listener that will do this?

P.S. I do not have the ability to edit the animation itself in Adobe Edge

1

There are 1 answers

0
7ochem On BEST ANSWER

I have solved this by adding a compositionReady listener. This event is taking place before the auto play, so I can influence the auto play settings of the animation.

I've put the code below right after calling AdobeEdge.loadComposition(). The timeout here is set to 2000 milliseconds. The solution works with animations having child symbols (using sym.ci which holds a reference to the child symbols).

AdobeEdge.bootstrapCallback(function(compId){
    AdobeEdge.Symbol.bindElementAction(compId, 'stage', 'document', 'compositionReady', function(sym, e){
        sym.stopAll(-1, false);
        sym.setAutoPlay(false);
        if (sym.ci) {
            for(var i = 0; i < sym.ci.length; ++i) {
                sym.ci[i].setAutoPlay(false);
            }
        }
        var playDelay = setTimeout(function(){
            sym.playAll();
        }, 2000);
    });
});