I am using a s:TextInput in Flex 4.5. It shows it’s prompt text if the underlying text value is null or empty String. Does anybody know if I can make either don’t show the prompt on empty String or even show a different prompt?
I already found a way by extending the TextInput class and overriding some of the methods but I am still hoping anyone here knows an easier way 😉
I am using a s:TextInput in Flex 4.5. It shows it’s prompt text if
Share
Ok, so based on the comments, here it is:
You store the current prompt value in a private variable, like so:
Then you create a getter, so the value is accessible from outside of this class:
Now you can bind inputPrompt anywhere you need it, however, the problem is the getter won’t be recalled once the private value changes. You can fix this very easily: Create an update method, for example like so:
Ok, nothing fancy so far. I’m guessing this is the point where you are right now. In order to “force” the getter to be recalled, you have to bind it to an event, like so:
Finally, you can simply dispatch this event when the value is update (i.e. in the updateInputPrompt method):
This way, the getter will be recalled every time you dispatch that event.
Hope this helps. Have a great day, and a great weekend!