try this one. but you need to handle text, if user delete the text then may
chance the text appears numeric or underscore at zero index.
[*Bindable*]
*private* *var* pos:Number=0;
*protected* *function* txt_changeHandler(event:TextOperationEvent):*void*
{
*//validateTextInput(txt.text.length);*
}
*protected* *function* txt_selectionChangeHandler(event:FlexEvent):*void*
{
pos=TextInput(event.target).selectionAnchorPosition;
validateTextInput(pos);
}
*private* *function* validateTextInput(cursorPos:int=-1):*void*
{
*if* (cursorPos > 0)
{
txt.restrict=*"a-zA-Z0-9_"*
}
*else*
{
txt.restrict=*"a-zA-Z"*
}
*trace*(*"Current Position --- "* + cursorPos);
}
<s:Label text="{*'lastCursorPos '* + pos}"/>
<s:TextInput id="txt"
restrict="a-zA-Z"
change="txt_changeHandler(event)"
selectionChange="txt_selectionChangeHandler(event)"/>
Regards
Gajanan
On Wed, Apr 9, 2014 at 1:00 PM, Naresh <[email protected]> wrote:
> Thanks friend for the reply,
>
> This code is very useful but small problem here,
>
> After enter the text, when I move cursor to first position, i can write
> numeric and _(underscore) special Character.
>
> Thanks in Advance
> Naresh
>
>
> On Tuesday, April 8, 2014 3:31:34 PM UTC+5:30, Naresh wrote:
>>
>> Hi Friends,
>>
>> I need to Restrict Two conditions in Text Input without using Validations
>>
>> eg.., 1st Character will be Alphabetic and followed with Alphabetical or
>> Numerical and special Character(_ Underscore). No Other special Character
>> will be allowed other than (_)underscore.
>>
>>
>> Thanks in Advance
>> Naresh
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Flex India Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/flex_india.
> For more options, visit https://groups.google.com/d/optout.
>
--
Thanks & Regards
Gajanan Pawale
Web Engineer
Mob No. 65-90294284
--
You received this message because you are subscribed to the Google Groups "Flex
India Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/flex_india.
For more options, visit https://groups.google.com/d/optout.