Is there a method for getting the last valu开发者_Go百科e of? I want the last number value of an amount that's incremented. I know I've seen this method. Thanks,
Subtract 1 from the current value. That will give you the previous value of a number that has been incremented. For example:
var current:Number = 0;
current += 1;
var previous:Number = current - 1;
You could wrap this in your own custom method if you want:
function getPreviousValue(current:Number):Number
{
return current - 1;
}
Perhaps:
var inc:Number = 450;
var total:Number = 100000000;
var target:Number = 0;
while( target < total ) {
var n:Number = target + inc < total ? inc : total - target;
target += n;
}
精彩评论