Skip to main content
Participant
January 30, 2008
Question

flash maths - scaling a number

  • January 30, 2008
  • 1 reply
  • 196 views
Hi guys,

I need help with a math problem

I need a math formula to scale a number from between 400 and 10000
to a number between 800 and 8000

In other words 400 would return a value of 800
10000 would return a value of 8000
and any number between 400 and 10000
would return a corresponding answer between
800 and 8000 the same percentage along the span of numbers.

For example the number half way between 400 and 10000
would return the number half way between 800 and 8000
This topic has been closed for replies.

1 reply

Inspiring
January 30, 2008
var destLow:Number = 800;
var destHigh:Number = 8000;
var origLow:Number = 400;
var origHigh:Number = 1000;

var num:Number = 500;

var newNum = destLow+(num-origLow)/(origHigh-origLow)*(destHigh-destLow);