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:
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!