I’d call preventDefault() on the textInput event.

On 3/2/10 9:48 PM, "Peeyush Tuli" <[email protected]> wrote:






not sure.. but check if this helps

http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=1049969

you might need to modify the original code..

~Peeyush
http://www.mds.asia

On Tue, Mar 2, 2010 at 8:30 PM, sasuke <uzumaki.naruto.is 
<http://uzumaki.naruto.is> @gmail.com <http://gmail.com> > wrote:






Hi all.

How would I achieve the task of restricting user input based on the current
contents of the TextInput? I am aware of the restrictChars property but that
doesn't help since it applies a blanket rule as to which characters are
allowed/not allowed.

An example here would be: allow the user to input a number with no more than
a precision of 2. In this case, as soon as the user enters 12.34 any more
keystrokes in the TextInput should become no-ops.

I did try adding event listeners to the KeyboardEvent.UP_KEY and
KeyboardEvent.DOWN_KEY but it seems that you can't stop the propagation or
prevent the default of keyboard events.

Any suggestions here would be very much appreciated. TIA,
sasuke

--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui

Reply via email to