# Problem with fading

**URL:** <https://forum.kirupa.com/t/problem-with-fading/231137>\
**Category:** flash\
**Created:** [July 2, 2007, 1:32pm UTC](https://forum.kirupa.com/t/problem-with-fading/231137 "2007-07-02T13:32:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emdiesse](https://avatars.discourse-cdn.com/v4/letter/e/c0e974/32.png) [@Emdiesse](https://forum.kirupa.com/u/Emdiesse)\
**Post date:** [July 2, 2007, 1:32pm UTC](https://forum.kirupa.com/t/problem-with-fading/231137/1 "2007-07-02T13:32:05Z")

</div>

[COLOR=Black]Hello. I am trying to fade in and out 2 movie clips when a button is pressed. Here is my AS, but it is not fading the content in and out. I have ran it through in my head a couple of times and is seems to be fine. I don’t know whats happening.  
[/COLOR][COLOR=Black]  
[/COLOR] [SIZE=1][COLOR=Black]Button AS:[/COLOR][/SIZE][COLOR=Black]  
[/COLOR][COLOR=Black]

```auto

on(release){
    PreviousContent = Content;
    Content = Info;
    stageListener.onResize();
}
[/COLOR][COLOR=Black]

```

[/COLOR]  
[SIZE=1]  
frame AS:[/SIZE]  
[COLOR=Black] [/COLOR][COLOR=Black]

```auto

var Content = Info;
var PreviousContent;

Portfolio._alpha = 0;
Services._alpha = 0;
Contact._alpha = 0;

var stageListener:Object = new Object();
stageListener.onResize = function ()
{
    fade(PreviousContent, 0); //Fade previous content to zero
    fade(Content, 100); //Fade new content to 100
}
Stage.addListener(stageListener);

function fade(mc, alpha){
    this.onEnterFrame = function(){
        if (Math.round(mc._alpha)>alpha) this.dir = -1;
        else this.dir = 1;
        this._alpha += this.dir;
    }
}
}

stageListener.onResize();

```

Any ideas why this is not fadeing the content in and out?  
[/COLOR]
