# Dynamic function help

**URL:** <https://forum.kirupa.com/t/dynamic-function-help/256962>\
**Category:** Uncategorized\
**Created:** [April 9, 2008, 4:33am UTC](https://forum.kirupa.com/t/dynamic-function-help/256962 "2008-04-09T04:33:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![iceflyin](https://avatars.discourse-cdn.com/v4/letter/i/9de053/32.png) [@iceflyin](https://forum.kirupa.com/u/iceflyin)\
**Post date:** [April 9, 2008, 4:33am UTC](https://forum.kirupa.com/t/dynamic-function-help/256962/1 "2008-04-09T04:33:23Z")

</div>

I’m trying to fade out objects with the ‘fadeObject’ listener when the mouse is over then, then fade back in.

This isn’t fading back in… 😕 Any ideas how to do this correctly? Flash CS3 - AS3.

```auto

function fadeObject(mc:MouseEvent) {
    trace(mc.target.name);
    mc.target.alpha = .70;
    mc.target.count = 30;
    mc.target.onEnterFrame = function (){
    this.count --;
    if (this.count > 10 && this.count <= 20){
    this.alpha = .80;
    } else if (this.count <= 10 && this.count >= 0){
    this.alpha = .90;
    } else {
    this.alpha = 1;
    }
    };
}

```
