The following example shows how you can style the base color on the Flex Gumbo FxHSlider control’s thumb and track by setting the baseColor 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/03/12/setting-the-base-color-on-the-fxhslider-control-in-flex-gumbo/ -->
<FxApplication name="FxHSlider_baseColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<VGroup horizontalCenter="0" verticalCenter="0">
<FxHSlider id="slider"
minimum="0"
maximum="100"
baseColor="haloOrange" />
</VGroup>
</FxApplication>
You can also set the baseColor 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/03/12/setting-the-base-color-on-the-fxhslider-control-in-flex-gumbo/ -->
<FxApplication name="FxHSlider_baseColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<Style>
FxHSlider {
baseColor: haloOrange;
}
</Style>
<VGroup horizontalCenter="0" verticalCenter="0">
<FxHSlider id="slider"
minimum="0"
maximum="100" />
</VGroup>
</FxApplication>
Or, you can set the baseColor style using ActionScript, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/03/12/setting-the-base-color-on-the-fxhslider-control-in-flex-gumbo/ -->
<FxApplication name="FxHSlider_baseColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<Script>
<![CDATA[
private function btn_click(evt:MouseEvent):void {
slider.setStyle("baseColor", "haloOrange");
}
]]>
</Script>
<VGroup horizontalCenter="0" verticalCenter="0">
<FxButton id="btn"
label="Set baseColor"
click="btn_click(event);" />
<FxHSlider id="slider"
minimum="0"
maximum="100" />
</VGroup>
</FxApplication>
Finally, if you wanted to set the baseColor style on the FxHSlider thumb and/or track individually, you could either create a custom FxHSlider skin and set the baseColor styles in the new skin, or you could style the #thumb and/or #track selectors directly, as seen in the following example:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2009/03/12/setting-the-base-color-on-the-fxhslider-control-in-flex-gumbo/ -->
<FxApplication name="FxHSlider_baseColor_test"
xmlns="http://ns.adobe.com/mxml/2009"
backgroundColor="white">
<Style>
FxHSlider #thumb {
baseColor: red;
}
FxHSlider #track {
baseColor: green;
}
</Style>
<VGroup horizontalCenter="0" verticalCenter="0">
<FxHSlider id="slider"
minimum="0"
maximum="100" />
</VGroup>
</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.
