Skip to main content
Participant
Sep 25, 2009 5:36 AM UTC
Question

How do you change the background color of text?

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 is closed to new replies. Start a new post to keep the conversation going.

6 replies

ab1301Author
Participant
Sep 25, 2009 6:24 AM UTC

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?

Translate
Participating Frequently
Sep 25, 2009 5:36 PM UTC

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);

Translate
ab1301Author
Participant
Sep 26, 2009 8:52 AM UTC


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

Translate