A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: timed loop

  1. #1
    YH Jelly Llama Jockey defuzz's Avatar
    Join Date
    May 2001
    Posts
    464
    hey guys, hope you can help ,me out with this one.

    What I want to do is have a loop that will run every few seconds. I thought about using a simple while loop but that would do like 30 loops instantly, I also considered making a movie clip with 20 empty frames to represent a time gap between "plays" but that seems a little messy.

    Ideally I need it to run every second (I know it will be more/less on different computers), I know it will be using the get timer (I assume) so any help would be great.


  2. #2
    Senior Member
    Join Date
    May 2001
    Posts
    170
    hey defuzz

    you can make this type of loop:

    //first frame:
    startTime = getTimer()
    endTime = 1000


    //second frame:
    if (getTimer() - startTime < endTime) {
    play()
    } else {
    gotoAndStop(1)
    }

    //third frame:
    if (getTimer() - startTime < endTime) {
    this.gotoAndPlay(2)
    } else {
    gotoAndStop(1)
    }


    hope this helps

    Alex

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