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

        • B
          Reply to Resizing images
          B
          Seems like common sense about not being able to crop a vertical photo into a horizontal space without problems, but you're not the only one running into it. Every now and then somebody will send me a...
          Today, 09:51 PM
        • B
          Reply to How can i delete outline of any shape?
          B
          I've used Illustrator most every day for nearly three decades now, and what you're showing in your image could be the result of about three or four dozen different problems or a combination of those things...
          Today, 09:10 PM
        • praxis11
          Comment on Logo design advice
          praxis11
          What exactly do we disagree on?
          Today, 08:14 PM
        • B
          Reply to Logo design advice
          B
          You didn't say that, nor did I imply that you did.

          What I'm saying is that you seem to be looking at it from the perspective of being able to learn on one's own to create interesting and...
          Today, 07:55 PM
        • praxis11
          Reply to Logo design advice
          praxis11
          Where did I suggest that crowdsourcing sites could provide a decent living?...
          Today, 07:14 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