Hack:
function format2 ( str ):String
{
var currencyFormattedString = str;
var a = currencyFormattedString.split(".");
currencyFormattedString = currencyFormattedString[0] + "0." +
currencyFormattedString[1];
}
my_lbl.text = format2 ( "$.25" );
----- Original Message -----
From: "Andriy Panas" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, July 19, 2006 12:24 PM
Subject: [flexcoders] Flex 1.5: HOWTO specify the MUST inclusion of 0 for
fractional numbers smaller than 1 using mx:CurrencyFormatter?
Hello , flexcoders
I was stumbled upon that all my fractional numbers like 0.25, 0.45,
0.65, etc are displayed after formatting with <mx:CurrencyFormatter>
like this:
$.25, $.45, $.65
What I want my numbers to be displayed is:
$0.25, $0.45, $.65.
I cannot find a simple and reliable way to specify the MUST inclusion
of 0 number when using standard <mx:CurrencyFormatter>. Playing with
currencySymbol="$0" attribute is not a reliable solution, IMHO.
Should I resort to writing my own formatter?
-----START of sample code copied from Flex 1.5 help section
(http://tinyurl.com/jyckh) --
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml">
<!-- Declare a CurrencyFormatter and define parameters. -->
<mx:CurrencyFormatter id="Price" precision="2"
rounding="none"
decimalSeparatorTo="."
thousandsSeparatorTo=","
useThousandsSeparator="true"
useNegativeSign="true"
currencySymbol="$0"
alignSymbol="left" />
<mx:Script>
<![CDATA[
var todaysPrice=0.25;
]]>
</mx:Script>
<!-- Trigger the formatter while populating a string with data. -->
<mx:TextInput text="Today's price is {Price.format(todaysPrice)}." />
</mx:Application>
---END of sample code copied from Flex 1.5 help section ------------------
--
Best regards,
Andriy mailto:[EMAIL PROTECTED]
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
------------------------ Yahoo! Groups Sponsor --------------------~-->
Great things are happening at Yahoo! Groups. See the new email design.
http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/