Foros del Web » Creando para Internet » Flash y Actionscript »

Problema con texto dinamico

Estas en el tema de Problema con texto dinamico en el foro de Flash y Actionscript en Foros del Web. Saludos a todos, espero me puedan ayudar. Este es mi AS2 Código: function calc_imp(ingreso, deduccion, base, opcion) { base_imponible = ingreso - deduccion; for (var ...
  #1 (permalink)  
Antiguo 27/11/2010, 00:13
 
Fecha de Ingreso: noviembre-2010
Mensajes: 1
Antigüedad: 13 años, 5 meses
Puntos: 0
Problema con texto dinamico

Saludos a todos, espero me puedan ayudar.

Este es mi AS2

Código:
function calc_imp(ingreso, deduccion, base, opcion)
{
    base_imponible = ingreso - deduccion;
    for (var _loc1 = 0; _loc1 < base.length; ++_loc1)
    {
        if (base_imponible >= base[_loc1][0] && base_imponible <= base[_loc1][1])
        {
            rango = _loc1;
        } // end if
    } // end of for
    impuesto = base[rango][2] + (base_imponible - base[rango][0]) * base[rango][3] / 100;
    if (base_imponible > 0)
    {
        ir = Math.abs(impuesto / ingreso * 100);
    }
    else
    {
        ir = 0;
    } // end else if
    if (opcion == 1)
    {
        return (Math.abs(impuesto));
    } // end if
    if (opcion == 2)
    {
        return (ir);
    } // end if
} // End of the function
var base = [[0, 8909, 0, 0], [8910, 11349, 0, 5], [11350, 14189, 122, 10], [14190, 17029, 406, 12], [17030, 34059, 747, 15], [34060, 51079, 3301, 20], [51080, 68109, 6705, 25], [68110, 90809, 10963, 30], [90810, 1000000, 17773, 35]];
ingresos_totales.onChanged = function (textfield_txt)
{
    if (ingresos_totales.text / 2 > 11583)
    {
        deduccion_maxima.text = 11583;
		base_imponible.text = Number(ingresos_totales.text) - Number(deduccion_maxima.text);
        impuesto2010.text = calc_imp(ingresos_totales.text, deduccion_maxima.text, base, 1);
        ir_ingresostotales.text = calc_imp(ingresos_totales.text, deduccion_maxima.text, base, 2);
    }
    else
    {
        deduccion_maxima.text = ingresos_totales.text / 2;
        base_imponible.text = Number(ingresos_totales.text) - Number(deduccion_maxima.text);
        impuesto2010.text = calc_imp(ingresos_totales.text, deduccion_maxima.text, base, 1);
        ir_ingresostotales.text = calc_imp(ingresos_totales.text, deduccion_maxima.text, base, 2);
    } // Testing
	};
ingresostotalesb.onChanged = function (textfield_txt)
{
    base_imponibleb.text = base_imponibleb.text = Number(ingresos_totalesb.text) - Number(deduccion_maximab.text);
    impuesto2010b.text = calc_imp(ingresostotalesb.text, deduccion_maximab.text, base, 1);
    ir_ingresostotalesb.text = calc_imp(ingresostotalesb.text, deduccion_maximab.text, base, 2);
};
deduccion_maximab.onChanged = function (textfield_txt)
{
    base_imponibleb.text = base_imponibleb.text = Number(ingresos_totalesb.text) - Number(deduccion_maximab.text);
    impuesto2010b.text = calc_imp(ingresostotalesb.text, deduccion_maximab.text, base, 1);
    ir_ingresostotalesb.text = calc_imp(ingresostotalesb.text, deduccion_maximab.text, base, 2);
};
ingreso = 20000;
deduccion = 10000;
test = calc_imp(ingreso, deduccion, base, 1);
He logrado que todos los campos funciones menos el de base_imponible es el único campo que al llenar el input no me arroja información. Espero puedan ayudarme, gracias.

Última edición por DeejayU; 27/11/2010 a las 00:17 Razón: Activando notificacion por correo
  #2 (permalink)  
Antiguo 27/11/2010, 09:41
Avatar de golem44  
Fecha de Ingreso: enero-2009
Ubicación: barcelona
Mensajes: 483
Antigüedad: 15 años, 3 meses
Puntos: 22
Respuesta: Problema con texto dinamico

Empieza poniendo trace dentro de los if i else, a ver si realmente esta leyendo y no ejecuta o si no esta leyendo ese script.

saludos

Etiquetas: dinamico, acciones
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:06.