Revision: 55838
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 23, 2012 23:40 by vamapaull
Initial Code
package com.vamapaull.utils { public class ValueConvertor { public static function convertRange(originalStart:Number, originalEnd:Number, newStart:Number, newEnd:Number, value:Number):Number { var originalRange:Number = originalEnd - originalStart; var newRange:Number = newEnd - newStart; var ratio:Number = newRange / originalRange; var newValue:Number = value * ratio; var finalValue:Number = newValue + newStart; return finalValue; } } }
Initial URL
http://blog.vamapaull.com/convert-values-within-a-range-to-values-within-another-range/
Initial Description
I’m sharing with you a little utility that I find myself using a lot lately. This utility is a value convertor that you can use in those times when you need to make a volume slider or something similar where you’ll need to change a value and a value range.
Initial Title
Convert values within a range to values within another range
Initial Tags
number, actionscript, flash
Initial Language
ActionScript 3