A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: setInterval..

  1. #1
    Member
    Join Date
    Sep 2006
    Posts
    44

    setInterval..

    how to call setInterval to loop again after the clearInterval? example.. if i press button i want to call the loop again do its function. Thanks..

  2. #2
    AKA [ Paul Bainbridge] webdreamer's Avatar
    Join Date
    Aug 2001
    Location
    Glasgow, Scotland, UK
    Posts
    3,320
    Check the flash Doc's. They are very clear on how to use setInterval, clearInterval.

    hope it helps
    .: To me AS is like LEGO, Only for the big Kids :.
    - Site - Blog - Twitter - Linkedin
    bringmadeleinehome.com

  3. #3
    Member
    Join Date
    Sep 2006
    Posts
    44
    yes, i already check it and there is no clue on how to loop it again.. anyway thanks...

  4. #4
    Senior Member
    Join Date
    Nov 2004
    Posts
    928
    this will call the interval everytime you press the button

    function interval() {
    trace("interval");
    clearInterval(intervalId);
    }
    button.onRelease = function() {
    intervalId = setInterval(interval,1000);
    }

  5. #5
    Senior Member Alluvian's Avatar
    Join Date
    Jun 2006
    Posts
    967
    You can also use setTimeout.

    setTimeout is undocumented, but takes exactly the same arguments of setInterval (works both with and without an object just like interval as well).

    The only difference with setTimeout is that it does not return the intervalID, becuase it only performs the function ONCE.

    button.onRelease = function() {
    setTimeout(trace,1000,"Words to trace")
    }

  6. #6
    Member
    Join Date
    Sep 2006
    Posts
    44
    thanks a lot.. i figure it already. and is used setTimeout also.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center