Ver Mensaje Individual
  #13 (permalink)  
Antiguo 04/07/2007, 03:58
Avatar de Mahalo
Mahalo
 
Fecha de Ingreso: julio-2004
Ubicación: Mallorca (Illes Balears)
Mensajes: 1.121
Antigüedad: 19 años, 9 meses
Puntos: 12
Re: simulador de credito

Pues fallan las rutas. Y yo definiría la función redondear por separado y la aplicaría al resultado final. Así:
Código:
function redondear(n:Number, decimales:Number):Number {
	var k:Number = Math.pow(10, decimales);
	return Math.round(n*k)/k;
}
botonoperacion.onRelease = function() {
	var cuotaFP:Number = (Number(_root.idcampo1.text)*0.7)/100;
	if (_root.idcampo2.text>=0 && _root.idcampo2.text<=5) {
		_root.idresultado.text = 420;
	}
	if (_root.idcampo2.text>=6 && _root.idcampo2.text<=9) {
		_root.idresultado.text = redondear(cuotaFP*1, 2);
	}
	if (_root.idcampo2.text>=10 && _root.idcampo2.text<=49) {
		_root.idresultado.text = redondear(cuotaFP*0.75, 2);
	}
	if (_root.idcampo2.text>=50 && _root.idcampo2.text<=249) {
		_root.idresultado.text = redondear(cuotaFP*0.6, 2);
	}
	if (_root.idcampo2.text>249) {
		_root.idresultado.text = redondear(cuotaFP*0.5, 2);
	}
	if (_root.idresultado.text<420) {
		_root.idresultado.text = 420;
	}
};
A ver si es la definitiva...