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
          Reply to Confidence
          PrintDriver
          The fun thing about an online store is, unless you set it up through something like zazzle or etsy (and even these aren't exempt but may have tools for users), you are essentially starting an online business....
          Today, 05:18 PM
        • PrintDriver
          Reply to Two little questions concerning the Pen Tool.
          PrintDriver
          For halftone dots, nothing beats Rasterbator. My favorite go to tool for vector halftone dots (from raster artwork such as a gradient created in photoshop just for the purpose of making a screen patt...
          Today, 05:13 PM
        • B
          Reply to Two little questions concerning the Pen Tool.
          B
          For the first one, you can do as Hotbutton said, which will work fine. You can also use the various tools in Illustrator's Pathfinder palette window to cut shapes apart. For example partially layering...
          Today, 01:49 PM
        • StudioMonkey
          Comment on Can't figure out the font, Please Help!
          StudioMonkey
          agreed
          Today, 01:34 PM
        • B
          Reply to Confidence
          B
          You can't be confident about not failing, but you'll never know unless you try. What you can be confident about are those things within your control, like doing your homework, looking at the target audience,...
          Today, 01: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