Announcement Announcement Module
Collapse
No announcement yet.
Question about setInterval in Flash 8 Page Title Module
Move Remove Collapse
Search Search Module
Collapse

Advertisement Advertisement Module
Collapse

Featured Images Featured Images Module
Collapse

Mediabistro Creative Sites Mediabistro Creative Sites Module
Collapse
Latest Topics Latest Topics Module
Collapse

  • Judy Smith
    Reply to The ad I posted in classifieds was not posted
    Judy Smith
    On the post, I had linked to a thread on this forum, wherein someone advised me to post the term "volunteer" in the subject line of the classifieds section....
    Today, 03:33 AM
  • PanToshi
    Reply to First Time App Project Advice Needed
    PanToshi
    Welcome to GDF dude

    We ask all new members to read the very important links here and here. These explain the rules and how the forum runs. No, you haven't done anything wrong, we ask every...
    Today, 02:17 AM
  • BillyLogan
    Reply to Opinions on My Logo?
    BillyLogan
    Absolutely better. Just make sure the tag line's readable if you ever print it....
    Today, 01:47 AM
  • BillyLogan
    Reply to Custom social icons
    BillyLogan
    For me, customizing your own social media icons reflect creativity and imagination. However, it may tend to look less professional because of the artistry of some people. So if you have a corporate website,...
    Today, 01:40 AM
  • garricks
    Reply to The ad I posted in classifieds was not posted
    garricks
    Judy, the description of the sub forum reads:

    Jobs and Paying projects.NO SPEC WORK OR CONTESTS! PAID WORK ONLY! IF IT'S NOT PAYING WORK DO NOT POST IT HERE!!! If you don't want the job,...
    Today, 12:49 AM
Advertisement Advertisement Module
Collapse

Sponsors Sponsors Module
Collapse

X
Conversation Detail Module
Collapse
  • 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

        Mediabistro A division of Prometheus Global Media home | site map | advertising/sponsorships | careers | contact us | help courses | browse jobs | freelancers | content | member benefits | reprints & permissions terms of use | privacy policy Copyright © 2014 Mediabistro Inc. call (212) 389-2000 or email us
        Working...
        X