The following example shows how you can set the content background color on the Flex Gumbo FxList control by setting the contentBackgroundColor 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"?>
<!-- -->
<FxApplication name="FxList_contentBackgroundColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<ApplicationControlBar dock="true" width="100%">
<Form styleName="plain">
<FormItem label="contentBackgroundColor:">
<ColorPicker id="colorPicker"
selectedColor="white" />
</FormItem>
<FormItem label="enabled:">
<FxCheckBox id="checkBox"
selected="true" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxList id="list"
contentBackgroundColor="{colorPicker.selectedColor}"
enabled="{checkBox.selected}"
horizontalCenter="0"
verticalCenter="0">
<dataProvider>
<ArrayCollection source="[One,Two,Three,Four,Five,Six]" />
</dataProvider>
</FxList>
</FxApplication>
You can also set the contentBackgroundColor style in an external .CSS file or <Style> block, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<FxApplication name="FxList_contentBackgroundColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<Style>
FxList {
contentBackgroundColor: #CCCCCC;
}
</Style>
<ApplicationControlBar dock="true" width="100%">
<Form styleName="plain">
<FormItem label="enabled:">
<FxCheckBox id="checkBox"
selected="true" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxList id="list"
enabled="{checkBox.selected}"
horizontalCenter="0"
verticalCenter="0">
<dataProvider>
<ArrayCollection source="[One,Two,Three,Four,Five,Six]" />
</dataProvider>
</FxList>
</FxApplication>
Or, you can also set the contentBackgroundColor style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- -->
<FxApplication name="FxList_contentBackgroundColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<Script>
<![CDATA[
import mx.events.ColorPickerEvent;
private function colorPicker_change(evt:ColorPickerEvent):void {
list.setStyle("contentBackgroundColor", evt.color);
}
]]>
</Script>
<ApplicationControlBar dock="true" width="100%">
<Form styleName="plain">
<FormItem label="contentBackgroundColor:">
<ColorPicker id="colorPicker"
selectedColor="white"
change="colorPicker_change(event);" />
</FormItem>
<FormItem label="enabled:">
<FxCheckBox id="checkBox"
selected="true" />
</FormItem>
</Form>
</ApplicationControlBar>
<FxList id="list"
enabled="{checkBox.selected}"
horizontalCenter="0"
verticalCenter="0">
<dataProvider>
<ArrayCollection source="[One,Two,Three,Four,Five,Six]" />
</dataProvider>
</FxList>
</FxApplication>
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.
