The following example shows how you can set a symbol color on a Flex Gumbo FxTextArea control by setting the symbolColor style.
Full code after the jump.
To use the following code, you must have Flash Player 10 and a Flex Gumbo SDK installed in your Flex Builder 3. For more information on downloading and installing the Gumbo SDK into Flex Builder 3, see “Using the beta Gumbo SDK in Flex Builder 3″.
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/01/05/setting-a-symbol-color-on-an-fxtextarea-control-in-flex-gumbo/ -->
<Application name="FxTextArea_symbolColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="symbolColor:">
<ColorPicker id="colorPicker" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxTextArea id="textArea"
symbolColor="{colorPicker.selectedColor}"
width="100%"
height="100%">
<text><String source="data/lorem.txt" /></text>
</FxTextArea>
</Application>
View source is enabled in the following example.
You can also set the symbolColor style in an external .CSS file or <Style> block, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/01/05/setting-a-symbol-color-on-an-fxtextarea-control-in-flex-gumbo/ -->
<Application name="FxTextArea_symbolColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<Style>
FxTextArea {
symbolColor: red;
}
</Style>
<FxTextArea id="textArea"
width="100%"
height="100%">
<text><String source="data/lorem.txt" /></text>
</FxTextArea>
</Application>
Or, you can set the symbolColor style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/01/05/setting-a-symbol-color-on-an-fxtextarea-control-in-flex-gumbo/ -->
<Application name="FxTextArea_symbolColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
layout="vertical"
verticalAlign="middle"
backgroundColor="white">
<Script>
<![CDATA[
import mx.events.ColorPickerEvent;
private function colorPicker_change(evt:ColorPickerEvent):void {
textArea.setStyle("symbolColor", evt.color);
}
]]>
</Script>
<ApplicationControlBar dock="true">
<Form styleName="plain">
<FormItem label="symbolColor:">
<ColorPicker id="colorPicker"
change="colorPicker_change(event);" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxTextArea id="textArea"
width="100%"
height="100%">
<text><String source="data/lorem.txt" /></text>
</FxTextArea>
</Application>
This entry is based on a beta version of the Flex Gumbo SDK and therefore is very likely to change as development of the Flex SDK continues. The API can (and will) change causing examples to possibly not compile in newer versions of the Flex Gumbo SDK.



I didn’t test this example but I tried to understand the effect of setting the property from the Gumbo sources, without success.
The “symbolColor” property seems to be specific to the Spark skin and it’s applied to the skin items returned by the “symbolItems()” getter. In the last SVN sources of Gumbo, FxTextAreaSkin isn’t overriding this getter and thus no item will use this property. Am I missing something or are you perhaps posting examples faster than the developers can commit their changes? :)
Haykel Ben Jemia,
The style should definitely work. I tested the code using the latest SDK I could find, but I didn’t have time to fire up the FTP client and post the example SWF. Actually, I’ll dig up the Flex Builder project, export a release build and try posting the SWF right now.
Peter