# Mod function \*edited\*

**URL:** <https://forum.kirupa.com/t/mod-function-edited/249772>\
**Category:** Uncategorized\
**Created:** [January 22, 2008, 2:00pm UTC](https://forum.kirupa.com/t/mod-function-edited/249772 "2008-01-22T14:00:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![randomagain](https://avatars.discourse-cdn.com/v4/letter/r/35a633/32.png) [@randomagain](https://forum.kirupa.com/u/randomagain)\
**Post date:** [January 22, 2008, 2:00pm UTC](https://forum.kirupa.com/t/mod-function-edited/249772/1 "2008-01-22T14:00:52Z")

</div>

Hi

there is a better way of doing on enterframe but I have forgotten it…

my version… in progress

```auto
 
function fade(mcTarget:MovieClip,newAlpha:Number,speed:Number):Void{
mcTarget.onEnterFrame = function():Void{
mcTarget._alpha+=(newAlpha-mcTarget._alpha)/(10/speed);
if (Math.abs(Math.round(mcTarget._alpha))==newAlpha) delete this.onEnterFrame;
}
}

```

thanks:bu:
