<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
backgroundGradientColors="[0x000000,0x323232]">
<mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
public var vresult:ValidationResultEvent;
public function format():void
{
vresult=numv.validate();
if(vresult.type==ValidationResultEvent.VALID)
{
var temp:Number=Number(tx1.text);
lb1.text=cf1.format(temp);
}
else
{
lb1.text="";
}
}
]]>
</mx:Script>
<mx:CurrencyFormatter id="cf1" decimalSeparatorFrom="." decimalSeparatorTo="."
currencySymbol="Rs" useThousandsSeparator="true" alignSymbol="left"
rounding="nearest" useNegativeSign="true" precision="2"/>
<mx:NumberValidator id="numv" source="{tx1}"
property="text" allowNegative="true" domain="real"/>
<mx:Panel title="CURRENCY VALIDATOR" x="378" y="189" width="302" height="194"
layout="absolute" color="#FB0505">
<mx:TextInput x="112" y="10" id="tx1"/>
<mx:Label x="131.5" y="40" id="lb1"/>
<mx:Button x="75" y="76" label="Currency Validator" id="bt1" click="format()"/>
<mx:Label x="10" y="12" text="Enter Ammount"/>
</mx:Panel>
</mx:Application>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
backgroundGradientColors="[0x000000,0x323232]">
<mx:Script>
<![CDATA[
import mx.events.ValidationResultEvent;
public var vresult:ValidationResultEvent;
public function format():void
{
vresult=numv.validate();
if(vresult.type==ValidationResultEvent.VALID)
{
var temp:Number=Number(tx1.text);
lb1.text=cf1.format(temp);
}
else
{
lb1.text="";
}
}
]]>
</mx:Script>
<mx:CurrencyFormatter id="cf1" decimalSeparatorFrom="." decimalSeparatorTo="."
currencySymbol="Rs" useThousandsSeparator="true" alignSymbol="left"
rounding="nearest" useNegativeSign="true" precision="2"/>
<mx:NumberValidator id="numv" source="{tx1}"
property="text" allowNegative="true" domain="real"/>
<mx:Panel title="CURRENCY VALIDATOR" x="378" y="189" width="302" height="194"
layout="absolute" color="#FB0505">
<mx:TextInput x="112" y="10" id="tx1"/>
<mx:Label x="131.5" y="40" id="lb1"/>
<mx:Button x="75" y="76" label="Currency Validator" id="bt1" click="format()"/>
<mx:Label x="10" y="12" text="Enter Ammount"/>
</mx:Panel>
</mx:Application>