views:

48

answers:

2

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,

+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
@heavily involved – good guess
jeremynealbrown
@jeremynealbrown yeah this is a tricky one :)
heavilyinvolved
@heavily involved, thanks
VideoDnd
+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
@jeremynealbrown, thanks. That's what I was looking for. I thought there was a method for this in Flash.
VideoDnd