Actionscript – Flex/Actionscript truncateToFit on label component

actionscriptapache-flexlabeltruncation

I have a number of labels in my Flex application which have the "truncateToFit" property on them set to true. The problem is that, instead of displaying '…' at the end of any truncated text it displays null.

I.e if my label's text was: "Hello Stackoverflow!" I might expect my label to look like this:

"Hello Stackov…"

Instead it displays

"Hello Stackovnull"

Any help would be useful!

Example of how truncation should look

Edit: – Example code:

<mx:HBox width="200" ... >
   <mx:Label maxWidth="150" truncateToFit="true" text="Really long text.Really long text.Really long text.Really long text.Really long text" />
</mx:HBox>

Best Answer

Ha ha! I found the solution. Sorry guys - It was probably my lack of information which made it hard for you guys to debug for m :(

So, anyway - It turns out I had an external resourceModule swf which my application loaded to get localised language data etc from - This file didn't include the some data about what text to display for the truncation (i.e. '...') and so it instead displayed 'null'. I added that data to the Resource swf and it's all working as expected.

Thanks a million for trying to help me out guys. ;)