7ochem
7ochem

Reputation: 2350

Adobe Edge how to disable auto play by code?

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

Upvotes: 0

Views: 600

Answers (1)

7ochem
7ochem

Reputation: 2350

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);
    });
});

Upvotes: 1

Related Questions