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

        Sponsor

        Collapse

        Incredible Stock

        Latest Topics

        Collapse

        • PrintDriver
          Comment on QuarkXPress 2017 introduced
          PrintDriver
          Hi wcali, nice rant. A lot of the software companies are forgetting their main purpose in life.
          The Output.
          As a printer, I have been going round and round with Adobe over features they have...
          Today, 08:46 AM
        • Peter3v
          Reply to Logo Design - Font to match and go alongside chosen logo
          Peter3v
          Hey B - If interested people would like to message me on earth2pete@hotmail.com that would be great. Thank you
          Today, 06:52 AM
        • Breanne.C
          Reply to Helloooooo!
          Breanne.C
          Actually, I do have a print related issue if you'd like to take a stab at helping me with. Should I post in the correct category with the issue and picture that goes with it?
          Yesterday, 10:29 PM
        • Breanne.C
          Reply to Font ID Please
          Breanne.C
          Oh yeah.

          Catorze27 Style 1 Bold best matched it, for the exception of the M, which I easily was able to fix....
          Yesterday, 10:14 PM
        • wcali
          Reply to QuarkXPress 2017 introduced
          wcali
          Hello Fellow Graphic Design Friends,

          Wanted to post here on a older post. I use CS5.5 and when I heard Quark was half prices it brought me back to a time when all I used was Quark, think...
          Yesterday, 08:28 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