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

        • salsa
          Reply to Graphic Designer's In Math
          salsa
          What kind of simple math do you use on a regular basis whilst doing your job?
          addition, subtraction, multiplication, division, fractions & percentages, ratios, geometry, basic algebra, patterns/sequences...
          Today, 05:31 PM
        • PanToshi
          Reply to Anyone w/Experience Working at a Design Agency?
          PanToshi
          In my area of the country, there are an abundance of this.

          Believe me, despite over 12 years of agency experience and 15 years being a ''freelancer'', even I have encountered this bias. Especially...
          Today, 03:10 PM
        • B
          Reply to Anyone w/Experience Working at a Design Agency?
          B
          I wouldn't say it means nothing. If it's coupled with all the other things, like internships, actual employment and education, it definitely counts for something.

          When I interview people...
          Today, 02:33 PM
        • B
          Reply to Graphic Designer's In Math
          B
          Looks like I'm going to be the oddball here and say that I rarely need any math beyond basic arithmetic to do my job. The most math-intensive, graphic design thing I run into is figuring percentages,...
          Today, 02:24 PM
        • PrintDriver
          Reply to Email setup for multiple addresses - best practices
          PrintDriver
          Don't assume they are downloading. Depending on how your mail is set up, it may only be accessing and cataloging from your email server.
          Where I work, on the mac with an IMAP account, you have to...
          Today, 01:53 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