• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

How to make dynamic text expand to fit text Flash CS4?

I have dynamic text converted to an so I can expand the dynamic text by 500% through a tween. The text ( a single word) in the box will change periodically so I can't say exactly how large of a box I'll need.

As the word in the box changes sometimes it fits, sometime it is just truncated at the right end. Sure wish the dynamic text box would expand itself to fit the text.

Anyway to do this without making the dynamic text box as big as my stage to start with?
0
chevronrod
Asked:
chevronrod
1 Solution
 
deepanjandasCommented:
Yes, using autosize property:

Try this sequence:
var titleFormat:TextFormat = new TextFormat();
titleFormat.bold = true;
titleFormat.color = 0xFFFFFF;
titleFormat.size = 14;

var titleLabel:TextField = new TextField();
titleLabel.defaultTextFormat = titleFormat;
titleLabel.autosize = "left";
titleLabel.label = data;
addChild( titleLabel );

Open in new window


Warm Regards
Deepanjan Das
0
 
chevronrodAuthor Commented:
Too bad they don't put autosize (and maybe some others) in the Properties panel of text boxes....
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now