# setTimeout and function do not work properly

**URL:** <https://forum.kirupa.com/t/settimeout-and-function-do-not-work-properly/276483>\
**Category:** flash\
**Created:** [November 28, 2008, 10:23am UTC](https://forum.kirupa.com/t/settimeout-and-function-do-not-work-properly/276483 "2008-11-28T10:23:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vcm11](https://avatars.discourse-cdn.com/v4/letter/v/9f8e36/32.png) [@vcm11](https://forum.kirupa.com/u/vcm11)\
**Post date:** [November 28, 2008, 10:23am UTC](https://forum.kirupa.com/t/settimeout-and-function-do-not-work-properly/276483/1 "2008-11-28T10:23:57Z")

</div>

Am i doing something wrong here?

can i use the function in this way?

```auto

setTimeout (fadeIn(cinema_mc, 3), 1000);

function fadeIn(mc, speed) {
	mc.onEnterFrame = function(speed) {
		if (this._alpha>=100) {
			delete this.onEnterFrame;
		} else {
			this._alpha += speed;
		}
	};
}

```
