Amigo da uma olhada:/

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"; layout="absolute">

<mx:Script>

<![CDATA[

*import* mx.formatters.CurrencyFormatter;

*import* mx.formatters.NumberFormatter;

*public* *function* somar():*void*{

*var* valor1:Number;

*var* valor2:Number;

*var* total:Number;

valor1 = strToFloat( t1.text );

valor2 = strToFloat( t2.text );

total = valor1 + valor2;

t3.text = floatToStr( total.toString() );

}

*public* *static* *function* strToFloat(d:String, precisao:int = -1):Number{


*var* nf:NumberFormatter = *new* NumberFormatter();

nf.decimalSeparatorFrom = *","*;

nf.decimalSeparatorTo = *"."*;

nf.thousandsSeparatorFrom = *"."*;

nf.thousandsSeparatorTo = *","*;

nf.useThousandsSeparator = *false*;

nf.precision = precisao;

*return* Number(nf.format(d));

}

*public* *static* *function* floatToStr(d:String, precisao:int = 2):String {


*var* nf:CurrencyFormatter = *new* CurrencyFormatter();

nf.decimalSeparatorTo=*","*;

nf.thousandsSeparatorTo = *"."*;

nf.useThousandsSeparator = *true*;

nf.currencySymbol = *""*;

nf.precision = precisao;

*return* nf.format(d);

}

]]>

</mx:Script>

<mx:Panel x="79.5" y="86" width="577" height="480" layout="absolute">

<mx:TextInput x="127" y="70" id="t1"/>

<mx:TextInput x="127" y="119" id="t2"/>

<mx:TextInput x="127" y="198" id="t3"/>

<mx:Button x="158" y="241" label="SOMAR" click="somar()"/>

<mx:Label x="60" y="72" text="Número 1"/>

<mx:Label x="60" y="121" text="Número 2"/>

<mx:Label x="60" y="200" text="Total"/>

</mx:Panel>

</mx:Application>


2009/7/1 Mário Júnior <juninho...@gmail.com>

> Acho q esse "problema" está no lado do servidor.... qual back-end? Faça um
> log do servidor e verifique como a informação está chegando lá.
>
> Outra coisa, sempre - por toda vida - eu usei (e ainda uso) os formatadores
> *default *do flex (numberFormat, currencyFormat, whatever...) e nunca tive
> problemas. No entanto, se quiser, pode usar essa dica do Eberton:
>
> http://www.flexdev.com.br/home/flex-fazendo-contas-corretamente/
>
>
> Abraços.
>
>
> 2009/7/1 Lorenzi <mlorenz...@gmail.com>
>
>>
>> Pessoal estou tendo problemas ao trabalhar com numeros no flex
>> gostaria de saber como vcs fazem em seus sistema se deixam como string
>> usam algum componente, eu estava usando o decimalInput mas ao importar
>> para a minha base de dados progress estou tendo problemas qto se tem
>> campos decimais, do tipo tenho 222.55 na minha base de dados fica como
>> 22.255. Alguem tem alguma dica??
>>
>>
>
>
> --
> Mário Júnior
> Programador Java / Adobe Flex
> http://blog.mariojunior.com
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com
Para sair da lista, envie um email em branco para 
flexdev-unsubscr...@googlegroups.com
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a