# Fade In - shouldn't this work?

**URL:** <https://forum.kirupa.com/t/fade-in-shouldnt-this-work/219956>\
**Category:** flash\
**Created:** [March 21, 2007, 2:41pm UTC](https://forum.kirupa.com/t/fade-in-shouldnt-this-work/219956 "2007-03-21T14:41:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![halian](https://avatars.discourse-cdn.com/v4/letter/h/45deac/32.png) [@halian](https://forum.kirupa.com/u/halian)\
**Post date:** [March 21, 2007, 2:41pm UTC](https://forum.kirupa.com/t/fade-in-shouldnt-this-work/219956/1 "2007-03-21T14:41:41Z")

</div>

hey all - i’m trying to do a simple fade in function. Then after a certain amount of time, fade it out, fade the new one in, rinse, wash and repeat. I thought that this should work for the fade in portion but it doesn’t seem to do so.

Not quite sure where i’m going wrong.  
I have an array of movieclips - i attachMovie and then try to run the function.

```auto
// array of movie clips
clipsArray = ["clip_1", "clip_2", "clip_3", "clip_4"];
// fade speed
speed = 10;
// fadeIn function
function fadeIn(target_mc) {
    target_mc.onEnterFrame = function() {
        this._alpha += speed;
        if (this._alpha>=100) {
            trace("fade in finished");
            delete this.onEnterFrame;
        }
    };
}
// attach the movie. this works. if i set the _alpha to 50, it's clearly there.
attachMovie(clipsArray[2], clipsArray[2], -3, {_alpha:0});
// run the fadeIn
fadeIn(clipsArray[2]);

```

Thanks
