This is to restrict multiple decimal and only 2 values after decimal
Hope this helps you..

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

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

<mx:Script>

<![CDATA[

*import* mx.controls.Alert;

*protected* *function* restrictOnDecimal(e:Event):*void*{

*if*(TextInput(e.currentTarget).text.indexOf(*'.'*,0).toString() != *'-1'*){

TextInput(e.currentTarget).restrict = *'0-9'*;

*if*(TextInput(e.currentTarget).text.indexOf(*'.'*,0) <
TextInput(e.currentTarget).maxChars-2)

TextInput(e.currentTarget).maxChars =
TextInput(e.currentTarget).text.indexOf(*'.'*,0) + 3;

}

*else*{

TextInput(e.currentTarget).restrict = *"'0-9','.'"*;

TextInput(e.currentTarget).maxChars = 10;

}

}

]]>

</mx:Script>

 <mx:TextInput id="ti" change="restrictOnDecimal(event)" restrict="
['0-9','.']" maxChars="10" x="399" y="112"/>

 </mx:Application>


-- 
Baluvasireddy

-- 
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en.

Reply via email to