# \[timing\] function timing - delay in script

**URL:** <https://forum.kirupa.com/t/timing-function-timing-delay-in-script/162804>\
**Category:** flash\
**Created:** [September 16, 2005, 12:40pm UTC](https://forum.kirupa.com/t/timing-function-timing-delay-in-script/162804 "2005-09-16T12:40:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chappo](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Chappo](https://forum.kirupa.com/u/Chappo)\
**Post date:** [September 16, 2005, 12:40pm UTC](https://forum.kirupa.com/t/timing-function-timing-delay-in-script/162804/1 "2005-09-16T12:40:21Z")

</div>

Hi all,

Back again to find help provided by helpfull flashers :bu:

Right now i have the following script

```php
var speed = 20;
MovieClip.prototype.slideIt = function(whereX) {
	this.onEnterFrame = function() {
		this._x += (whereX-this._x)/speed;
		if (Math.abs(this._x-whereX)<1) {
			this._x = whereX;
			delete this.onEnterFrame;
		}
	};
};

green.onRollOver = function() {	
	blue.slideIt(520);
	red.slideIt(550);
};
green.onRollOut = function() {
	blue.slideIt(193);
	red.slideIt(386);
};

```

What i want to do is pretty simple, i want the onRollOver to be delayed for a few seconds before it runs the slideIt script.

I searched on kirupa for similar actions and found this

> **[Timing a function](https://www.kirupa.com/forum/showthread.php?t=47450)**
>
> Got a web design/development question or just want to hang out with the most awesome people on the planet? Drop on in!

but how can i implement this in my own script ? tried a few things but all it does is either nothing or even more nothing …

Need some help on this - Thanks in advance
