I am creating an ItemRenderer for a list component in a Flex application. In my item renderer I have a StyleableTextField which contains a short description of the current item in the list. If this comment gets to long (as it probably will) I would like to truncate it with a ... on the end.
It it possible to do that with the StyleableTextField? Also, if the device is rotated, I would like the truncation to change to new width. Is that also possible?
I suppose the second would be possible if the first is possible. All I have to do is listen for a StageOrientationEvent.ORIENTATION_CHANGING event.
Thank you for your time.
StyleableTextField has a public method
that truncates the text to make it fit horizontally, and appends an ellipsis (…) to the text.
Another option is to use LabelItemRenderer which truncates its text automatically (via build-in StyleableTextField) and adds ellipsis marks. You can use LabelItemRender as is or extend it to implement your custom LabelItemRenderer.
Some more reading on how to extend LabelItemRenderer: