R – Handling TextInput width and styles in Flex

actionscript-3apache-flexflex3mxmltextinput

I made a Form container with few TextInput fields in Flex and I would like to change a style of clicked TextInput element. I managed to do it with MouseEvent.CLICK event listener but it is not what I expected.
I would like to change style of TextInput when user try to edit that field. However, I want to change back to 'default' style when user clicks another TextInput field or outside any field. Is there some event listener made specific for such interactions?

I have also a question, is it possible to make width of TextInput depending on amount of text? I mean to resize it to width of text inside of it? Text comes from some database and is always different widths…

Thanks for help!

Best Answer

Instead of using click events, use "focus" and "blur" events. This way you'll pick up on the event as the user clicks (or tabs) to the field, and you'll also pick up on the event when they leave the field.

Related Topic