ok, i've realised that if i use a whole number as the input, then it works fine, but most likely the input will include 2 decimal places, is there a function that will allow the 'answer' to stay at 2 decimals event if the input contains decimals?
Can no one help wit this then? I've tried all sorts, Math.round, toPersicion, toFixed, but no matter what i use, if i input a decimal the function fails, i've tried looking for a report of a bug in Flex 3 for this, but no one else seems to be having this trouble....
Ha! Cracked it! For anyone else who's struggling withthis sort of thing, here's the answer:
Code:
private function CalculatePercentage(event:Event):void
{
var myNumber:Number = new Number(price_input.text);
var wholeNumber:Number = (myNumber * 100);
var revertBack:Number = (wholeNumber /10000);
var GetPercentage:Number = (revertBack * 15);
var percentageAnswer:Number = (GetPercentage + myNumber);
var answer:Number = percentageAnswer;
var display:String = answer.toFixed(2);// fixing to 2 decimals
var text:String = display.toString();
withPercentageprice.text = text;
}