This content has been marked as final. Show 4 replies
I've now tried a workaround with labels/textInputs that autosizes and flows.
But I don't get the editing I want. Since I can't select text between the inputboxes.
Does anyone have any info on the problem with background colors on specific ranges of text?
That has been asked here before with no useful response. Basically you would need to do it yourself. It isn't terribly hard to do, just tedious.
This is easier with using a single font/height for your code, but basically you can use TextLineMetrics to get information about a given line of text, or more specifically a given letter. You can then draw the background based on those offsets. (With single font/size, you can cache the metrics for each letter in an Object, but with variable size or different fonts, that may require a lot of caching so you may need to do the metrics for every letter which is slower).
I know Quasimondo has some code for justifying text that may be useful as a starting point, if metrics aren't specifically available in the FLex SDK code when using those controls. If they are, then just copy it to your project, give it a different package name, and hook with the code you need.
You insert html code. I know this crude, but it works. Here is a textarea what you want.
<mx:TextArea width="600" height="100" fontSize="16"
Three methods for solving the quadratic equation are listed above.<b>
<font color="#99ccff">With some color and
<p> This is a paragraph. and more <b>This text is bold</b>
This text is italic
This is <font color="#FF0000">HTML text</font> in a <b>TextArea component</b>. Using the <u>htmlText attribute</u> of the <font color="#008800">TextArea component</font> you can use basic HTML markup
<p>This is <b>some</b> content to <i>render</i> as <u>HTML</u> text.</p>
This doesn't help the question of background colors, just foreground.