Hi,
Is there a method for getting the last value of? I want
the last number value of an amount that's incremented.
I know I've seen this method.
Thanks,
views:
48answers:
2
+2
A:
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;
}
heavilyinvolved
2010-07-22 17:11:13
@heavily involved – good guess
jeremynealbrown
2010-07-22 17:17:44
@jeremynealbrown yeah this is a tricky one :)
heavilyinvolved
2010-07-22 17:29:45
@heavily involved, thanks
VideoDnd
2010-07-22 20:19:38
+1
A:
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;
}
jeremynealbrown
2010-07-22 17:21:16
@jeremynealbrown, thanks. That's what I was looking for. I thought there was a method for this in Flash.
VideoDnd
2010-07-22 17:42:16