title: Wait function Action Script 2.0
body: <p>I am creating a website that has an intro splash page that waits for 5 seconds before automatically sending the playhead to frame 17 if nobody has clicked the enter button doing the same thing.</p>
  
  <p>My code for this is here:</p>
  
  <p>function wait() {
  stop();
  var myInterval = setInterval(function () {
        _level0.menu_number2 = 0;
        gotoAndStop(17);
        clearInterval(myInterval);
     }, 5*1000); // stop for 5 seconds
  }
  wait();</p>
  
  <p>This all works fine but if I haven't waited and am in the site before 5 seconds is up I suddenly get taken back to frame 17 unintentionally after 5 seconds.</p>
  
  <p>Now I know I need something in my code structure to check to see if the conditions have changed during these five seconds i.e the play head has moved beyond frame 15 and if so not to do anything but I am not sure what this something is. </p>
  
  <p>please help. </p>