title: How do I load an edge animation with an AJAX call? jquery getScript fails
body: <p>So I´m trying to retrieving an Edge animation through jQuerys $.getScript() which is the same as calling $.ajax with dataType: script.</p>
  
  <p>Now if I include the script with a script tag it works fine, but when I try to load and execute the script through $.getScript() nothing happens. (I dont get any errors, and the script and sub-scripts are loaded fine - but nothing happens.)</p>
  
  <p>Have anyone tried doing this before? I suspect I have problems loading it through AJAX because Adobe uses yepnope in page_a_edgePreload.js.</p>
  
  <p>I used a simple example I found from the Adobe Edge for testing purposes.
  If you want to try it out locally - open a editor and save the following into a wrapper.html file:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv='Content-Type' content='text/html; charset=utf-8'&gt;
  &lt;title&gt;Edge always wanted to be a Wrapper&lt;/title&gt;
  &lt;style&gt;
      .edgeLoad-PAGE_A { display:none; }
  &lt;/style&gt;
  &lt;script src="edge_includes/jquery-1.7.1.min.js"&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body style="margin:0;padding:0;"&gt;
  &lt;H1&gt;WRAPPER.HTML&lt;/H1&gt;
  
  &lt;div id="content" class="PAGE_A"&gt;
     &lt;p&gt;EDGE animation composition should appear beneath me!&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
  $.getScript("page_a_edgePreload.js", function(data, textStatus, jqxhr) {
     //console.log(data); //data returned
     console.log(textStatus); //success
     console.log(jqxhr.status); //200
     console.log('Load was performed.');
  });
  &lt;/script&gt;
    &lt;!--uncomment script below to see that it works if included regulary --&gt;
  &lt;!--&lt;script src="page_a_edgePreload.js"&gt;&lt;/script&gt;--&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And then download the example .zip file from Adobe here:
  <a href="http://blogs.adobe.com/edge/files/2012/05/an15BootStrapExample.zip" rel="nofollow">http://blogs.adobe.com/edge/files/2012/05/an15BootStrapExample.zip</a></p>
  
  <p>Extract the following into the same folder as your wrapper.html:</p>
  
  <ol>
  <li>edge_includes folder</li>
  <li>page_a_edge.js</li>
  <li>page_a_edgeActions.js</li>
  <li>page_a_edgePreload.js</li>
  </ol>
  
  <hr>
  
  <p><em>EDIT</em></p>
  
  <p>Ok, so I tried loading the files without going through the edgePreloader.js as suggested by Alex. I get access to the AdobeEdge, but it returns undefined if I write out the composition after successfully loading the scripts:</p>
  
  <pre><code>var comp = window.AdobeEdge.getComposition("PAGE_A");
  var stage = comp.getStage();
  console.log("Stage: " + stage);
  </code></pre>
  
  <p>(I also tried this with a setTimeout() function - still same result)</p>
  
  <p>The following works fine if I include the script in a regular <code>&lt;script src="..edgePreloader.js"&gt;&lt;/script&gt;</code> tag</p>
  
  <pre><code> setTimeout(function() {
    // Try getting the edge composition after 2 seconds
      var comp = window.AdobeEdge.getComposition("PAGE_A");
      var stage = comp.getStage();
      console.log("Stage: " + stage);
    }, 2000);
  </code></pre>
  
  <p>I notice that Adobe uses closures on the edgePreload.js, seems that I must load edge.1.5.0.js inside this closure. Im now trying to understand what events and features that are essential in this closure in order to get it working.</p>