# Need help stopping a alpha fade

**URL:** <https://forum.kirupa.com/t/need-help-stopping-a-alpha-fade/157428>\
**Category:** flash\
**Created:** [August 1, 2005, 10:19pm UTC](https://forum.kirupa.com/t/need-help-stopping-a-alpha-fade/157428 "2005-08-01T22:19:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nik\_fiend](https://avatars.discourse-cdn.com/v4/letter/n/ed655f/32.png) [@nik\_fiend](https://forum.kirupa.com/u/nik_fiend)\
**Post date:** [August 1, 2005, 10:19pm UTC](https://forum.kirupa.com/t/need-help-stopping-a-alpha-fade/157428/1 "2005-08-01T22:19:33Z")

</div>

this works but repeatidly fades in and out. I need to know how stop this after one loop and where to insert the script.

MovieClip.prototype.fade = function(minAlpha, maxAlpha, speed) {  
this.onEnterFrame = function() {  
if (!this.trigger) {  
this.\_alpha -= speed;  
if (this.\_alpha\<=minAlpha) {  
this.\_alpha = minAlpha;  
this.trigger = true;  
}  
} else if (this.trigger) {  
this.\_alpha += speed;  
if (this.\_alpha\>=maxAlpha) {  
this.\_alpha = maxAlpha;  
this.trigger = false;

```
                    }
                    
                {
                }
            }
    };

```

};  
clipToFade.fade(0, 100, 5)
