Change Style of selected TAB in TabBar dynamically with FLEX 4
I want to change the background color of selected tab in spark TabBar control(Flex4).
Till Flex3 we could have use the following code, bt it is not working in FLEX 4.
<fx:Script>
<![CDATA[
protected function tabbedPanel_clickHandler(event:MouseEvent):void
{
var tab:Tab = Tab(tabbedPanel.getChildAt(1));
tab.setStyle("fillC开发者_开发问答olors", ["red", "white"]);
tab.setStyle("fillAlphas", [1.0, 1.0]);
tab.setStyle("backgroundColor", "red");
}
]]>
</fx:Script>
<s:TabBar id="tabbedPanel" direction="ltr" x="10" y="20" height="22" cornerRadius="5" dataProvider="{viewStack}" click="tabbedPanel_clickHandler(event)" />
tab.setStyle("chromeColor", "#CCCCCC");
Just right click above the TabBar ( in design mode ), and choose "Create skin" then follow the wizzard, and change whatever you wana lately with the result skin.
With Flex 4, the skining shall be more proper way to define custom look and feels of the components, as soon as they are Spark based.
精彩评论