- stretching dynamic text fields in Flash?
- Posted by J-Dogg on November 12th, 2003
Hi everyone,
For all the Flash junkies out there:
How do I make a text field dynamically fit its contents?
I have a movie clip instance, called "macromedia", which holds a dynamic
text area, called "myText".
The frame script in the mc says:
myText = this._name;
so when the movie is published, myText reads "macromedia".
The problem is that I want the text area to fit the text, not just be one
length and either crop the text if it's too much or be longer than the text
if it's too short.
The purpose is to duplicate the mc based on the number of items in an array,
and fill the dynamic text area "myText" with contents of the array. Then
each mc should be only as long as the sentence it contains, so it can scroll
to the end and stop within a masked area. Each sentence is between 50-100
words, and will be supplied by the client the day before the CDs get duped,
so I'd like to make it as dynamic as possible.
TIA
Jeremy
- Posted by Davide Montellanico on November 12th, 2003
Hi Jeremy,
I hope you are using Flash MX, because with it is a very simple task:
Give your text field an instance name *in my example will be myText*, and
use the 'text' property with this object to assign a string content or in
your case the value of the '_name' property relative to your movie clip.
Example:
myText.text=this._name;
To make the text field dynamically fit its content use the 'autoSize'
property. you can assign different values to this property:
* left (the text field expands or contracts its right and bottom sides to
fit all contained text). You can use also the boolean value true for this
case.
* right ( the text field expands or contracts its left and bottom sides to
fit all contained text).
* center (the text field expands but the horizontal center of the text field
stays anchored at the text field's original horizontal center position).
Example:
myText.autoSize="left";
or
myText.autoSize=true;
HTH
cheers and let me know if all it's OK !
--
Davide :-)
"J-Dogg" <j-dogg@quitspammingme.net> ha scritto nel messaggio
news:w_qsb.18450$jA6.10509@bignews6.bellsouth.net. ..
- Posted by J-Dogg on November 12th, 2003
Perfect! That did it.
Thanks,
J
"Davide Montellanico" <latinsoul@my-deja.com> wrote in message
news:HQrsb.14176$hV.538843@news2.tin.it...
- Posted by Matt Bostock on November 12th, 2003
Don't ya just love a happy ending :-D
Matt
--
I miss Rage Against The Machine.
"J-Dogg" <j-dogg@quitspammingme.net> wrote in message
news:04ssb.19170$jA6.5169@bignews6.bellsouth.net.. .
---
No viruses found in this message.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.538 / Virus Database: 333 - Release Date: 10/11/03