# Alpha fade AS help

**URL:** <https://forum.kirupa.com/t/alpha-fade-as-help/304217>\
**Category:** flash\
**Created:** [February 3, 2010, 4:47pm UTC](https://forum.kirupa.com/t/alpha-fade-as-help/304217 "2010-02-03T16:47:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![smileyblonde1](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@smileyblonde1](https://forum.kirupa.com/u/smileyblonde1)\
**Post date:** [February 3, 2010, 4:47pm UTC](https://forum.kirupa.com/t/alpha-fade-as-help/304217/1 "2010-02-03T16:47:53Z")

</div>

[COLOR=black][FONT=Verdana]Hi There,[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]If someone could help me with this problem that would be great.[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]Inside a mc on the first frame I have put the following alpha AS fade in;[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=red][FONT=Verdana]this.\_alpha=0;  
this.fader=1;[/FONT][/COLOR]  
[COLOR=red][FONT=Verdana]this.onEnterFrame = function(){  
if (this.fader==1){  
this.\_alpha+=6;  
if (this.\_alpha\>=100){  
this.fader=0;  
}  
}else if (this.fader==2){  
this.\_alpha-=6;  
if (this.\_alpha\<=0){  
this.fader=0;  
}  
}  
}[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]On the very last frame I would like it to fade out so I thought I would reverse the code?[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=red][FONT=Verdana]this.\_alpha=100;  
this.fader=2;[/FONT][/COLOR]  
[COLOR=red][FONT=Verdana]this.onEnterFrame = function(){  
if (this.fader==1){  
this.\_alpha+=6;  
if (this.\_alpha\>=0){  
this.fader=0;  
}  
}else if (this.fader==2){  
this.\_alpha-=6;  
if (this.\_alpha\<=0){  
this.fader=0;  
}  
}  
}[/FONT][/COLOR]  
[COLOR=black][FONT=Verdana] [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]But this last bit of code gets totally ignored and it doesn’t fade out. I know it works because I have tested it in the first frame. Does the last bit of code in the first frame set the alpha for the rest of the mc and override anything else? [/FONT][/COLOR]  
[COLOR=black][FONT=Verdana][/FONT][/COLOR]  
[COLOR=black][FONT=Verdana]Cheers for any help? (new to AS)[/FONT][/COLOR]  
[COLOR=#22229c]

[/COLOR]
