csteinhilber
Programmer
I'm not really a Flash newbie, but for some reason this seemingly simple task has never come up before and I find myself stymied.
I have a multi-line, wrapping, dynamic text object that is "listening" to variable var1.
I load var1 with text from an external file (JSON, to be precise). This text can be anywhere from a couple of words to a couple dozen words (ie - 1 line to maybe 3 or 4 lines).
Loading the text works like a charm. But...
How do I:
a) resize the text field so it accomodates the entire string?
b) reposition the text field so that the text is always centered on the stage (both horizontally and vertically)?
and, for bonus points, I might like to actually adjust the font size of the text object so that no matter how much text I'm displaying, it's always taking up roughly the same amount of stage real estate (ie - less text = larger font size, more text = smaller font size). Would this be possible?
I figure I'll be loading the var1 (and thus the text object) with text, while the text object is off stage, and then positioning it on stage when loading is complete to avoid any flicker.
Any help would be appreciated.
Thanks in advance!
-Carl
I have a multi-line, wrapping, dynamic text object that is "listening" to variable var1.
I load var1 with text from an external file (JSON, to be precise). This text can be anywhere from a couple of words to a couple dozen words (ie - 1 line to maybe 3 or 4 lines).
Loading the text works like a charm. But...
How do I:
a) resize the text field so it accomodates the entire string?
b) reposition the text field so that the text is always centered on the stage (both horizontally and vertically)?
and, for bonus points, I might like to actually adjust the font size of the text object so that no matter how much text I'm displaying, it's always taking up roughly the same amount of stage real estate (ie - less text = larger font size, more text = smaller font size). Would this be possible?
I figure I'll be loading the var1 (and thus the text object) with text, while the text object is off stage, and then positioning it on stage when loading is complete to avoid any flicker.
Any help would be appreciated.
Thanks in advance!
-Carl