# Simple question: Function will not stop?

**URL:** <https://forum.kirupa.com/t/simple-question-function-will-not-stop/170116>\
**Category:** flash\
**Created:** [November 22, 2005, 10:29pm UTC](https://forum.kirupa.com/t/simple-question-function-will-not-stop/170116 "2005-11-22T22:29:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Battin](https://avatars.discourse-cdn.com/v4/letter/b/8dc957/32.png) [@Battin](https://forum.kirupa.com/u/Battin)\
**Post date:** [November 22, 2005, 10:29pm UTC](https://forum.kirupa.com/t/simple-question-function-will-not-stop/170116/1 "2005-11-22T22:29:41Z")

</div>

This is a problem i always run into when doing actionscript… i am not so skilled, so this might be because i write my code in a stupid way. please teach me!

I am doing an image slideshow, and this prototype function is fading the image out, and calling a function to load the next. But it kinda “stays” in the else if section. And traces “Else if” a million times. What is wrong? I made the else if(fade) thing to prevent that!

```auto

MovieClip.prototype.fadeMe2 = function() {
	fade = true;
	this.onEnterFrame = function() {
		if (fade && this._alpha>1) {
			this._alpha -= 2;
		} else if(fade) {
			trace("else if");
			this._alpha = 0;
			shuffleIt();
			fade = false;
		} else {
			//
		};
	};
};

```
