1 Reply Latest reply on Sep 6, 2006 5:51 PM by Rothrock


    PDMart Level 1
      I'm sure this is asked a lot. Is there an easy way to make a function wait before doing something? i.e. wait(1000); or is the only way to do it to use getTime(); and whatnot? How do i do it?

      i want it to be like this:

      myFunction = function ( ) {
      do something;
      do something else
      wait some seconds
      myOtherFunction ( );
        • 1. Re: Wait
          Rothrock Level 5
          Very easy – yet somehow confusing for a lot of folks. Check out the help files for setInterval. But basically the setInterval handles the wait part. So it isn't part of the function. Also setInterval really means "do this function repeatedly at the specified interval." But you can use it once and then clear the interval to achieve the effect you want.

          //do something


          setInterval is specified in milliseconds, but it isn't exact it is approximate. If you need exact intervals in Flash you are just going to have problems, so let's not even go there!