yishayw commented on issue #1216: URL: https://github.com/apache/royale-asjs/issues/1216#issuecomment-1346112765
The following works for me: ``` <?xml version="1.0" encoding="utf-8"?> <!-- Simple example to demonstrate the CurrencyFormatter. --> <mx:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:custom="*" xmlns:mx="library://ns.apache.org/royale/mx"> <fx:Script> <![CDATA[ import mx.events.ValidationResultEvent; private var vResult:ValidationResultEvent; // Event handler to validate and format input. private function Format():void { vResult = numVal.validate(); if (vResult.type==ValidationResultEvent.VALID) { var temp:Number = Number(priceUS.text); formattedUSPrice.text = usdFormatter.format(temp); } else { formattedUSPrice.text = ""; } } ]]> </fx:Script> <fx:Declarations> < id="usdFormatter" precision="2" currencySymbol="$" decimalSeparatorFrom="." decimalSeparatorTo="." useNegativeSign="true" useThousandsSeparator="true" alignSymbol="left"/> <mx:NumberValidator id="numVal" source="{priceUS}" property="text" allowNegative="true" domain="real"/> </fx:Declarations> <mx:Panel title="CurrencyFormatter Example" width="800" height="600" horizontalCenter="0" verticalCenter="0"> <mx:Form left="10" right="10" top="10" bottom="10"> <mx:FormItem label="Enter U.S. dollar amount:"> <mx:TextInput id="priceUS" text="" width="50%"/> </mx:FormItem> <mx:FormItem label="Formatted amount: "> <mx:TextInput id="formattedUSPrice" text="" width="50%" editable="false"/> </mx:FormItem> <mx:FormItem> <mx:Button label="Validate and Format" click="Format();"/> </mx:FormItem> </mx:Form> </mx:Panel> </mx:Application> ``` Where custom:CustomFormatter is ``` <?xml version="1.0" encoding="utf-8"?> <mx:CurrencyFormatter xmlns:mx="library://ns.apache.org/royale/mx"> </mx:CurrencyFormatter> ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@royale.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org