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

        • hyena
          Comment on Useful skills to learn?
          hyena
          Indeed, that's why I said. "You'd also need some knowledge how wrapping works, before you actually want to Design them"
          Today, 03:23 PM
        • Craig B
          Reply to Saving Patterns in Ai
          Craig B
          when saving swatches ASE in Illustrator a popup box shows up saying that gradients, patterns etc. won't be saved. However, if you save your swatches (using the same flyout menu) as an AI file it will....
          Today, 03:17 PM
        • Cosmo
          Comment on Introduction and thinking about freelancing
          Cosmo
          I've only even heard of freelancer.com. Never heard of the other two.
          Today, 02:11 PM
        • mikelamar
          Saving Patterns in Ai
          mikelamar
          Hi guys. I made some patterns in Ai CC and tried to save them via the flyout menu in swatches like pattern.ase but when I opened then nothing appeared. Can you help me please.
          Today, 12:06 PM
        • PrintDriver
          Comment on Useful skills to learn?
          PrintDriver
          That website with every type of car detail, front back sides top, doesn't show the flairs and cuts of the car body itself. A flat linear outline is not gonna tell you anything about the flair height of...
          Today, 11:40 AM

        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