tags:

views:

846

answers:

2

In my Flex 3 application the user enters IP addresses into a textInput object.

As the user enters the numbers comprising the ip address I would like to add the '.' on the fly rather than waiting until latter, so that if the user types 127000000001 I would like the textInput control to display 127.000.000.001.

I've been trying to make a class that extends textInput and adds the '.'s to the object's text property in the Event.CHANGE or Event.TextInput handler.

Sadly, my extra '.' never gets displayed, the numbers appear without dots just as the user typed them.

Any suggestions as to how to extend textInput to display numbers in the IP dot notation?

+2  A: 

A better bet might be to use the YAHOO! Astra Flex Components library, which contains a custom component for this very purpose.

Vinay Sajip
A: 

Have you tried overriding the component, and it's "text" setter function? That should work.

override public function set text(value:String):void {
     super.text = <value formatted as IP address>
}
Glenn