3 ways to get control in Flex over user input through Keyboard
February 10, 2009 at 6:10 AM | In Flex / AS, Programming | Leave a CommentTags: actionscript, flex, input text, text input, unicodeRange, validation
1. Use of restrict property. The following example allows only numeric input
<mx:TextInput id="textInput" restrict="0-9\-" />
2. Use of unicodeRange style property inside CSS (stylesheet) while embedding fonts. The following example restricts all special symbols except period sign(.).
@font-face
{
src:url("../assets/myFont.ttf");
fontFamily: myFontFamily;
flashType: true;
unicodeRange:
U 0041-U 005A, /* Upper-Case [A..Z] */
U 0061-U 007A, /* Lower-Case a-z */
U 0030-U 0039, /* Numbers [0..9] */
U 002E-U 002E; /* Period [.] */
}
3. Use of Flex built in validator components. Following example calls handleValid and makes it sure that user does not leave inputComponent blank.
<mx:Validator id="reqValid" required="true" source="{inputComponent}" property="text" valid="handleValid(event)" invalid="handleValid(event)"/>
No Comments Yet »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.
