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

        • Pavlo
          Reply to Graphic Designer needs a Camera
          Pavlo
          I think the limiting factor here will not be the camera – it will be your photographic knowledge, lighting and studio experience as well as image processing and retouching skills using software such...
          Yesterday, 11:00 PM
        • Nierste86
          Reply to Identity crisis with my personal identity?!
          Nierste86
          As so many have already iterated, the first two could be mistake for a woman's chest. If you want them to look more like teeth maybe draw them as a molar tooth to read as teeh. As far as your current...
          Yesterday, 10:06 PM
        • Nierste86
          Reply to Personal rebranding: feedback please
          Nierste86
          Still trying to get the hang of this forums formatting
          ...
          Yesterday, 08:50 PM
        • Kayekaye
          Reply to Dream jobs?
          Kayekaye
          Designing surfboards on Waikiki beach. Course I wouldn't make enough money to be able to actually live there...
          Yesterday, 08:18 PM
        • Kayekaye
          Reply to Trouble brewing in freelance land?
          Kayekaye
          Well so it goes. Been there done that. Had one client that told me he wanted to pay me to teach his 18 year old "artsy" son to do all my work. Left him high and dry. Another situation I worked...
          Yesterday, 08:00 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