Skip to main content
Participant
September 25, 2009
Question

How do you change the background color of text?

  • September 25, 2009
  • 1 reply
  • 1611 views

According to the language reference, the CharacterFormat class has no backgroundColor property.  Can this be right?  I can't believe they omitted such a basic thing.  There must be some other way to change the background color of a span of text, but how?

This topic has been closed for replies.

1 reply

ab1301Author
Participant
September 25, 2009

I found this highlighting example for TLF, but I can't find the source code:

http://www.matthewfabb.com/examples/tlf/highlight_adornment.html

Does anyone know where the source code for this is?

Participating Frequently
September 25, 2009

By changing the format of TextFlow, you're able to change the background color.  Here is an example.  Hope it helps.

var

format:TextLayoutFormat = new TextLayoutFormat();

format.backgroundColor = 0x2200ff;

var textFlow:TextFlow = TextConverter.importToFlow(Markup, TextConverter.TEXT_LAYOUT_FORMAT);

textFlow.flowComposer =

new StandardFlowComposer();

var editManager:IEditManager = new EditManager();

textFlow.interactionManager = editManager;

editManager.applyContainerFormat(format);

editManager.applyFormatToElement(editManager.textFlow,format);

ab1301Author
Participant
September 26, 2009


1046: Type was not found or was not a compile-time constant: TextLayoutFormat.