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

        • SabrinaHartford
          Reply to Feedback on Hawaii dessert (baking) cook book cover
          SabrinaHartford
          The actual recipes are a mix of semi-Hawaiian and authentic Hawaiian (e.g. Koi, Haupia and Kulolo are proper Hawaiian Desserts, but then Manju Cake, Bibingka Cake, Chocolate Tofu Mousse pie and Hawaiian...
          Today, 02:42 AM
        • B
          Comment on [HELO] Convert web image for billboard
          B
          Well, who knows. They might have their reasons that would make sense if we knew them.

          You're right, though, it's their money and if that's what they insist they want -- despite your best...
          Yesterday, 09:21 PM
        • MazeMiami
          Reply to [HELO] Convert web image for billboard
          MazeMiami
          I'm grateful for the time both you spent to inform me and respect your expertise. Didn't mean to sound like I was disregarding what you shared. Just figure if it's not going to make much of a difference...
          Yesterday, 09:16 PM
        • B
          Reply to Get Your Graphic Design License Here
          B
          Hmmm, good question. Probably not. Most generally recognized professions seem to have licensing requirements, though, so I guess my comments stem from designers being somehow excluded and the profession...
          Yesterday, 09:14 PM
        • MazeMiami
          Reply to [HELO] Convert web image for billboard
          MazeMiami
          No one gave me a solution seems like either way I would get similar results. I suggested the clients use the file we already have in hand and they insisted they wanted vector. I'm open to having the imaged...
          Yesterday, 09:07 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