# Delay function

**URL:** https://forum.kirupa.com/t/delay-function/54698
**Category:** Uncategorized
**Created:** [June 16, 2004, 9:35pm UTC](https://forum.kirupa.com/t/delay-function/54698 "2004-06-16T21:35:28Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Nikini](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/nikini/32/225_2.png) [@Nikini](https://forum.kirupa.com/u/Nikini)
#### Post date: [June 16, 2004, 9:35pm UTC](https://forum.kirupa.com/t/delay-function/54698/1 "2004-06-16T21:35:28Z")

</div>

hello…  
i’m made a delay function. The problem is that it does not work…

```auto

delay = function(s,fps) {
	tt=new Number(); tr=new Boolean();
	_root.onEnterFrame=function() {
		tt++;
		if (tt==s*fps) {
			tr=true;
		} else {
			tr=false;
		}
	}
	return tr;
}

```

i want the function to return true when s seconds have passed on a fps fps movieclip and false after and before. why doesn’t it work??
