# Every 5 seconds is an action: AS2

**URL:** https://forum.kirupa.com/t/every-5-seconds-is-an-action-as2/282691
**Category:** flash
**Created:** [February 25, 2009, 10:23am UTC](https://forum.kirupa.com/t/every-5-seconds-is-an-action-as2/282691 "2009-02-25T10:23:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lilleypants](https://avatars.discourse-cdn.com/v4/letter/l/f17d59/32.png) [@lilleypants](https://forum.kirupa.com/u/lilleypants)
#### Post date: [February 25, 2009, 10:23am UTC](https://forum.kirupa.com/t/every-5-seconds-is-an-action-as2/282691/1 "2009-02-25T10:23:31Z")

</div>

In the game I am building I need every 5 seconds a function to be called. The function looks like the following:

```auto
ballOrder = function(){
_global.balls = random(3);
trace(_global.balls);

if(_global.balls == 0){;
_global.greenballTween.play();
}
}

```

How would I go about making a time that pretty much counts to 5 and then resets itself again?
