# AS3 +/- volume

**URL:** <https://forum.kirupa.com/t/as3-volume/262731>\
**Category:** flash\
**Created:** [June 9, 2008, 3:08pm UTC](https://forum.kirupa.com/t/as3-volume/262731 "2008-06-09T15:08:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![greatbigbrain](https://avatars.discourse-cdn.com/v4/letter/g/3be4f8/32.png) [@greatbigbrain](https://forum.kirupa.com/u/greatbigbrain)\
**Post date:** [June 9, 2008, 3:08pm UTC](https://forum.kirupa.com/t/as3-volume/262731/1 "2008-06-09T15:08:58Z")

</div>

Hey All,  
I’m trying to have volume buttons that increase/decrease my FLV’s volume by 1/10, so the volume can be decreased to 0 in 10 clicks of the ‘down’ volume button, and increased to 1 by 10 clicks of the ‘up’ volume button (as volume values now go from 0 to 1, not 0 to 100).  
The problem is I’m getting strange, long decimal results when I try to do it (and I still get weird results when I round to a single decimal place). I have tried adding/subtracting ‘0.1’, as well as ‘1/10’, but the results are the same. Here are my functions:

```auto
function clickVolUp(e:MouseEvent):void {
	if (volTrans.volume < 1) {
		var newVol:Number = int((volTrans.volume + 0.1)*10)/10;
		volTrans.volume = newVol;
		ns.soundTransform = volTrans;
	}
};

function clickVolDown(e:MouseEvent):void {
	if (volTrans.volume > 0) {
		var newVol:Number = int((volTrans.volume - 1/10)*10)/10;
		volTrans.volume = newVol;
		ns.soundTransform = volTrans;
	}
};

```

All help is appreciated!
