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

        • manishbjain
          Reply to Should I follow this Histogram ?
          manishbjain
          Kindly ignore the knob . I had already corrected it after I posted this. How abt otherwise ? Does the image look fine to you or the Before version was good. Do you feel the depth I felt required was actually...
          Today, 01:42 AM
        • KitchWitch
          Reply to Show customer Pantones used in design
          KitchWitch
          Hi Northeast Ink and welcome to GDF.

          We ask all new members to read very important links here and here. These explain the rules, how the forum runs and a few inside jokes. No, you haven't...
          Yesterday, 07:16 PM
        • Northeast Ink
          Show customer Pantones used in design
          Northeast Ink
          I am wondering if there is a setting or plug-in in Indesign or acrobat in which I can automatically place/show the Pantones I used in my design. Right now I have to draw out boxes and label the Pantones...
          Yesterday, 06:42 PM
        • praxis11
          Reply to NEW Simplified Logo for Travel Guide
          praxis11
          I think you'd do better to put a smily face in one of the circular letter forms, as that would at least emphasize commitment to 'nice'.
          Yesterday, 06:38 PM
        • PrintDriver
          Reply to Need Help with Creative Logo Design Advice
          PrintDriver
          If the logo is not what you had in mind, why do you show it here?
          If you are working with a crowdsource, let that be a lesson to you.
          Yesterday, 06:12 PM

        20% Off Sale at iStock until Sept 30, 2016
        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