title: HTML5 Canvas Variable Control in Flash
body: <p>I'm using timeline animation and JavaScript in Flash to export an HTML5 canvas animation. The variables I declare at the start of the timeline are undefined when they're called at the end of the timeline. For instance:</p>
  
  <pre><code>var myCounter = 0; // frame 1
  
  
  
  setTimeout(function(){
      if(myCounter &lt; 1){
          exportRoot.play("replay");
      } else{this.stop();}
  },5000); // located in last frame
  </code></pre>
  
  <p>Why is <code>myCounter</code> undefined in the last frame? I'm trying to loop this several times. Also, where can I find methods to use for this since traditional JavaScript doesn't seem to always work (maybe it's me)?</p>