If you want to use TextFormat, you can apply a textformat to a text
selection. A quick way to do this without creating a bunch of new
textformat objects is to copy the current format into a temp var
using tf.getTextFormat(), change the color, and the apply it to the
selection with
my_textField.setTextFormat(beginIndex:Number, endIndex:Number,
textFormat:TextFormat)
or of course you can maintain a few TextFormat objects if you have a
set of styles you wish to work with.
Alternatively you could use a CSS stylesheet, but this may be a rare
circumstance where textFormat is better.
On Oct 9, 2006, at 2:24 PM, Doug Tangren wrote:
I was wondering if if is possible to dynamically change the color
of parts of a string within a single text field.
I know how to set the color of the whole text by applying a new
Text format object to a text field but I was wondering how I might
apply a different color to a substring of the target text field
while preserving the original text format color for the rest of the
text.
I am writing a class that loops through the index of a string and
changes the case of a character and I would also like to be able to
change the color without complicating things by dynamically
splitting the text into separate text fields and aligning them
based on the text's width.
Doug Tangren
[EMAIL PROTECTED]
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com