1 Reply Latest reply on Mar 12, 2013 2:55 AM by simonwidjaja

    Using API with Javascript


      Hi all, i've been trying to get this going for a week now and I am still unable to access the Edge Animate instane through Javascript.


      Here is the error I always get

      Uncaught TypeError: Object #has no method 'getComposition'



      And my code


      <!DOCTYPE html>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
                <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
      <!--Adobe Edge Runtime-->
          <script type="text/javascript" charset="utf-8" src="complete_girl_edgePreload.js"></script>
                          var comp = AdobeEdge.getComposition("complete_Girl");
                          var stage = comp.getStage();
              .edgeLoad-complete_Girl { visibility:hidden; }
      <!--Adobe Edge Runtime End-->
      <body style="margin:0;padding:0;">
                <div id="Stage" class="complete_Girl">


      It's weird that the documentation recommends using the following which wouldnt run at all:

      Edge.getComposition( compId )
        • 1. Re: Using API with Javascript

          Hi theJae,

          I think I can help you with this one...

          The loading process of any Animate composition is asynchronous. Loading the "_edgePreload.js" file provides the global EdgeAnimate object but not the instantiated composition yet (asynch loading). So the solution is to use the bootstrap callback to wait for the composition to be loaded completely. I've built a demo with multiple compositions and interaction between them. It's a little more than you are actually looking for, but it demonstrates the usage of the bootstrap callback pretty good.




          BTW: "The Edge.* interface is available to use, but you should reference the global AdobeEdge variable if attempting to access the object from outside of the Edge Animate runtime."


          Hope that helps!


          Happy Coding,

          Simon Widjaja