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

Latest Topics Latest Topics Module
Collapse

  • PanToshi
    Reply to Deciding which photoshop software to purchase + portfolio help
    PanToshi
    Hi Sapphire and welcome to GDF.

    I would recommend getting a bachelors degree in GD or related creative major. Employers look for candidates based on their education+ 2-years work experiece...
    Today, 04:26 AM
  • GMRooster
    Hand Drawn Albumn Art
    GMRooster
    Well yes, the band failed. We never went anywhere with it. Heere is the hand drawn album art. It's suposed to be the willamette river with Portland in the background:

    ...
    Today, 04:12 AM
  • PanToshi
    Reply to Mixtape Designer
    PanToshi
    Hi asapmatt27 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 done...
    Today, 04:04 AM
  • PanToshi
    Reply to Greetings
    PanToshi
    Hi GMRooster 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 done...
    Today, 03:58 AM
  • GMRooster
    Reply to Font for this Logo?
    GMRooster
    To OP. Good design. I like it for simplicity and the fact that you are utilizing transparent or negative space. The cut away look is a super plus. Here is one I did for a different forum. It's transparent...
    Today, 03:49 AM

Powered by mediabistro.com
Mediabistro Creative Sites Mediabistro Creative Sites 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 © 2015 Mediabistro Inc.
        Working...
        X