Announcement

Collapse
No announcement yet.

Question about setInterval in Flash 8

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question about setInterval in Flash 8

    I was always wondering about how to use setInterval correctly in Flash 8 , as I can't clearly know the meaning of this script . Could anyone who can explain a bit for me ? Thanks in advance!
    http://www.liuhuan.com

    Decayedwood design .

  • #2
    Is there any difference in setting setInterval in functions and in root timeline?
    http://www.liuhuan.com

    Decayedwood design .

    Comment


    • #3
      setInterval keeps a function repeating indefinitely. Here's an example:

      function setIntervalExample() {
      trace("This message will repeat ten times.");
      loopThis++;
      if (loopThis >= 10) {
      clearInterval(testInterval);
      }
      }

      var testInterval:Number = setInterval(setIntervalExample, 1000);


      Basically that trace message would repeat indefinitely if I had not put that if/else loopThis statement to clear the interval after ten times. The "1000" in the testInterval variable is the milliseconds it repeats so you can speed it up or slow it down by playing with the number.

      Comment


      • #4
        Thanks very much !!

        A few other questions , how about if I define the Interval in function ?

        For example :

        function myfunction(){
        var testInterval = setInterval(this , setIntervalExample, 1000);
        }

        function setIntervalExample(){
        trace("This message will repeat ten times.");
        loopThis++;
        if (loopThis >= 10) {
        clearInterval(testInterval);
        }
        }

        myfunction();


        Do these codes have the same results with your code ?
        http://www.liuhuan.com

        Decayedwood design .

        Comment

        Search

        Collapse

        Advertisement

        Collapse

        Latest Topics

        Collapse

        • MumboJum73
          Reply to Need critique for logo
          MumboJum73
          I agree with what has been said above. I think you can stick with the font but the brain imagery must be re-worked. The idea is a good one but has been done a lot. That can be good or bad depending on...
          Today, 07:34 PM
        • Juanm89
          Reply to Security One Redesign
          Juanm89
          Thank you so much guys
          Today, 07:28 PM
        • B
          Comment on Sign My Shoe!
          B
          It might seem a little flat footed, but that's right instep with what I was thinking.
          Today, 07:23 PM
        • HiddenDev
          Reply to Need critique for logo
          HiddenDev
          Hello, welcome to the forums.

          I agree that the puzzle pieces aren't quite in the "right" positions. I like the way they are placed randomly, but it's way too cluttered.
          ...
          Today, 05:06 PM
        • Cosmo
          Reply to Logo and Business Card feedback
          Cosmo
          I'll say the same thing I say all the time. Design your logo in black and white. And design it with a pencil and paper, not on the computer. When I design a logo, the computer is only on maybe the last...
          Today, 04:54 PM

        GDF A division of Mediabistro Holdings Adweek | Mediabistro | Clio | Film Expo Group Contact Us | Terms of Use | Privacy Policy Copyright 2016 Mediabistro Holdings
        Working...
        X