dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: HELP: Timebased loop

  1. #1
    Junior Member
    Join Date
    Dec 2000
    Posts
    2
    my problem:

    I need to run a loop that goes on like, let's say 288 times... but in
    a span of FIVE seconds. how do i do that without doing it the old
    fashion way of a Frame Loop?
    basically in FIVE miliseconds, i need to divide it by that same (288)
    value, then a command will be triggered everytime the time (in
    miliseconds) increments... that is, incrementing every "x" times
    where "x" is 5000ms / 288x.

    Hope u guys understand my english.... well, i tried my best :-D

    thanks in advance
    Andy


  2. #2
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    loop_time = something/else;

    function giveMeBreak()
    {
    // write your loop here

    // check loop end condition [to terminate loop]
    if i > 100
    clearInterval(theID);
    }

    theID = setInterval(giveMeBreak, loop_time);

    hope this helps. [MX only]

  3. #3
    Junior Member
    Join Date
    Dec 2000
    Posts
    2

    Smile

    Thanks so much dude... it was good help. Didn't even know that setInterval existed before that.

    best regards

  4. #4
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    enjoy Flashing!

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