# Sound fade in/fade out - fine, but not first time!

**URL:** <https://forum.kirupa.com/t/sound-fade-in-fade-out-fine-but-not-first-time/242953>\
**Category:** flash\
**Created:** [October 31, 2007, 10:59pm UTC](https://forum.kirupa.com/t/sound-fade-in-fade-out-fine-but-not-first-time/242953 "2007-10-31T22:59:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![davelaruedrum](https://avatars.discourse-cdn.com/v4/letter/d/4da419/32.png) [@davelaruedrum](https://forum.kirupa.com/u/davelaruedrum)\
**Post date:** [October 31, 2007, 10:59pm UTC](https://forum.kirupa.com/t/sound-fade-in-fade-out-fine-but-not-first-time/242953/1 "2007-10-31T22:59:06Z")

</div>

I followed Kenny Bellows tutorial on fade in/fade out: [http://www.kennybellew.com/](http://www.kennybellew.com/)  
Everything seems to work fine, except it won’t fade out the first time i click. After the first time, it fades fine.  
Anyone had this problem?

```auto
this.onEnterFrame = function () {

	//fade out and in
	if (daveFadeOut == 1){
		daveSoundVolume = daveSoundVolume - 1;
		daveSound.setVolume(daveSoundVolume);
	}
	
	if (daveSoundVolume < 1){
		daveSoundVolume = 0;
		daveFadeOut=0;
	}
	if (daveFadeIn == 1){
		daveSoundVolume = daveSoundVolume + 1;
		daveSound.setVolume(daveSoundVolume);
	}
	if (daveSoundVolume > 29){
		daveSoundVolume = 30;
		daveFadeIn=0;
	}	
	//finish fade out and in
}

```

Cheers,  
Dave
