Hi,

You had the right idea in the first place. After you created the popup
you can set that variable from outside the popup only if the variable
is public. So all u need to do is change var op from private to
public.

After that u can use the textInput or change event provided in the
TextInput to check what the user has entered and allow or disallow it
based on the value in 'op'.

This is similar to what bala subramanyam suggested only it works after
the user has typed rather then before the user has typed.

On Feb 3, 9:44 am, bala subramanyam <[email protected]> wrote:
>  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