# Inversely proportional mouseX?

**URL:** <https://forum.kirupa.com/t/inversely-proportional-mousex/285625>\
**Category:** flash\
**Created:** [April 3, 2009, 4:23am UTC](https://forum.kirupa.com/t/inversely-proportional-mousex/285625 "2009-04-03T04:23:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patcharan](https://avatars.discourse-cdn.com/v4/letter/p/7ba0ec/32.png) [@patcharan](https://forum.kirupa.com/u/patcharan)\
**Post date:** [April 3, 2009, 4:23am UTC](https://forum.kirupa.com/t/inversely-proportional-mousex/285625/1 "2009-04-03T04:23:28Z")

</div>

I’m trying to fade out one looping sound while fading in the other - so sound A will play full volume/sound B will be silent when mouseX is at 1 and sound B will play at full volume/sound A will be silent when mouseX is at 1000.

Here’s what I have - I have one of the sounds working ok, but I have no idea how to make an inversely proportional thing…

[COLOR=Blue]var[/COLOR] sunSound:sunnySound = [COLOR=Blue]new[/COLOR] sunnySound();  
[COLOR=Blue]var[/COLOR] sunChannel:SoundChannel = [COLOR=Blue]new SoundChannel/COLOR;  
[COLOR=Blue]var[/COLOR] sunTransform:[COLOR=Blue]SoundTransform[/COLOR] = [COLOR=Blue]new SoundTransform/COLOR;  
sunChannel = sunSound.[COLOR=Blue]play[/COLOR](0, 1000, sunTransform);  
[COLOR=Blue]var[/COLOR] rainSound:rainySound = [COLOR=Blue]new [/COLOR]rainySound();  
[COLOR=Blue]var[/COLOR] rainChannel:[COLOR=Blue]SoundChannel[/COLOR] = [COLOR=Blue]new SoundChannel/COLOR;  
[COLOR=Blue]var[/COLOR] rainTransform:[COLOR=Blue]SoundTransform[/COLOR] = [COLOR=Blue]new SoundTransform/COLOR;  
rainChannel = rainSound.[COLOR=Blue]play[/COLOR](0, 1000, rainTransform);  
sunTransform.[COLOR=Blue]volume[/COLOR] = [COLOR=Blue]mouseX[/COLOR]/1000;  
sunChannel.[COLOR=Blue]soundTransform[/COLOR] = sunTransform;  
[COLOR=SlateGray]// rainTransform.volume = ???  
// rainChannel.soundTransform = rainTransform;[/COLOR]

Thanks in advance for any help!
