title: javascript: Best way to do the function after page load
body: <p>I use google converted swiffy script like this</p>
  
  <pre><code>var stage = new swiffy.Stage(document.getElementById('swiffycontainer'),swiffyobject);
  stage.start();
  </code></pre>
  
  <p>My point is I want to do the action after the animation end.
  but I don't know how to track the frame on swiffy object.</p>
  
  <p>this is my work before asking</p>
  
  <ul>
  <li><p>I put start method after page is loaded on</p>
  
  <p>$(document).ready</p>
  
  <p>$(window).load</p>
  
  <p>window.onload =</p></li>
  </ul>
  
  <p>and track the time (random test to reach the last frame) with</p>
  
  <pre><code>setTimeout(callAtEnd(),10000);
  </code></pre>
  
  <p>result: not work; like it count the time when page is rendering, not after complete rendered</p>
  
  <ul>
  <li>let it start method and put setTimeout on load (should count after complete rander</li>
  </ul>
  
  <p>result: not work either</p>
  
  <p>Please help or give other solution to do.</p>
  
  <p>Many thanks.</p>