# A more efficient function for fading movie clips

**URL:** <https://forum.kirupa.com/t/a-more-efficient-function-for-fading-movie-clips/305001>\
**Category:** Uncategorized\
**Created:** [February 17, 2010, 9:36pm UTC](https://forum.kirupa.com/t/a-more-efficient-function-for-fading-movie-clips/305001 "2010-02-17T21:36:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lletdownl](https://avatars.discourse-cdn.com/v4/letter/l/6a8cbe/32.png) [@lletdownl](https://forum.kirupa.com/u/lletdownl)\
**Post date:** [February 17, 2010, 9:36pm UTC](https://forum.kirupa.com/t/a-more-efficient-function-for-fading-movie-clips/305001/1 "2010-02-17T21:36:23Z")

</div>

Hi everyone…

So, i am using this generic type of function all over a website im building to fade in and out movie clips…

```auto
function fadeIn(target) {
	target._alpha = 0;
	onEnterFrame = function () {
		target._alpha += 10;
		if (target._alpha>=100) {
			target._alpha = 100;
			delete onEnterFrame;
		}
	};
}

```

im finding it to be really really buggy. It seems to only partially complete its course once every 20-30 clicks… in other words, more than often enough to notice. Does anyone why i might be having so many problems with it? Can anyone suggest a more efficient code which does the same thing?

Thanks for any help…
