如何让动画在Adobe Edge中相继播放?

时间:2014-09-10 02:27:29

标签: adobe-edge yepnope

我有一个主index.html页面,并在div容器中有许多动画,如下所示:

<div style="height:100%;width:100%;">
   <div id="StageHelloWorld" class="Composition-HelloWorld"></div>
</div>
<div style="height:100%;width:100%;">
   <div id="StageHelloWorldAgain" class="Composition-HelloWorldAgain"></div>
</div>

我按如下方式加载动画:

yepnope({load: ["edgeTemplates/HelloWorldAgain/HelloWorldAgain_edgePreload.js",
                 "edgeTemplates/HelloWorld/HelloWorld_edgePreload.js"],
            callback: function(url, result, key){
                //when the script is loaded, run these:
                AdobeEdge.loadResources();
                AdobeEdge.playWhenReady();

                AdobeEdge.bootstrapCallback(function(compID){


                    console.log("Ready for : " + url);

                });
            }});
    }, 6000);  

然后在代码中,我通过以下方式触发每个动画(一次一个):

 $("#StageHelloWorldAgain").hide();
 $("#StageHelloWorld").show();
 AdobeEdge.getComposition("Composition-HelloWorld").getStage().getSymbol("stage").play(0, true);

 $("#StageHelloWorld").hide();
 $("#StageHelloWorldAgain").show();
 AdobeEdge.getComposition("Composition-HelloWorldAgain").getStage().getSymbol("stage").play(0, true);

所以我会在上面之间交替(在一段固定的时间之后)。

我注意到我在yepnope中加载的脚本的顺序决定了哪个动画在显示时是动画的。所以:

yepnope({load: ["edgeTemplates/HelloWorldAgain/HelloWorldAgain_edgePreload.js",
                 "edgeTemplates/HelloWorld/HelloWorld_edgePreload.js"],

edgeTemplates / HelloWorld / HelloWorld_edgePreload.js是动画的,但如果我切换顺序,则显示最后一个脚本的最后一个动画。

那么如何才能正确加载两个动画,这样当我对动画进行show()时,它会按预期动画?

1 个答案:

答案 0 :(得分:0)

由于我刚开始使用Adobe Edge,因此我在自己的文件夹中创建了许多项目。所以每个人都有自己的adobe运行时js文件版本。

一旦我将所有项目都指向同一个运行时文件,动画就会按顺序开始播放。