AS3 Convert a Value to a Percentage


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. private function valueToPercent($value:Number, $min:Number, $max:Number):Number {
  2. var myPercent:Number;
  3. var difference:Number = $max - $min;
  4. myPercent = (($value - $min) / difference);
  5. return myPercent;
  6. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.