ComboBox控件的fillColors样式。

示例:

代码:

<?xml version="1.0" encoding="utf-8"?>

<!-- http://blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/ -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

        layout="vertical"

        verticalAlign="top"

        backgroundColor="white">


    <mx:Array id="arr">

        <mx:Object label="One" />

        <mx:Object label="Two" />

        <mx:Object label="Three" />

        <mx:Object label="Four" />

        <mx:Object label="Five" />

        <mx:Object label="Six" />

    </mx:Array>


    <mx:ComboBox id="comboBox"

            dataProvider="{arr}"

            fillColors="[red, haloOrange]" />


</mx:Application>



还可以通过CSS来修改:

<?xml version="1.0" encoding="utf-8"?>

<!-- http://blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/ -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

        layout="vertical"

        verticalAlign="top"

        backgroundColor="white">


    <mx:Style>

        ComboBox {

            fillColors: red, haloOrange;

        }

    </mx:Style>


    <mx:Array id="arr">

        <mx:Object label="One" />

        <mx:Object label="Two" />

        <mx:Object label="Three" />

        <mx:Object label="Four" />

        <mx:Object label="Five" />

        <mx:Object label="Six" />

    </mx:Array>


    <mx:ComboBox id="comboBox"

            dataProvider="{arr}" />


</mx:Application>



也可以通过AS来实现:

<?xml version="1.0" encoding="utf-8"?>

<!-- http://blog.flexexamples.com/2008/06/14/changing-the-background-fill-colors-on-a-combobox-control-in-flex/ -->

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

        layout="vertical"

        verticalAlign="top"

        backgroundColor="white">


    <mx:Script>

        <![CDATA[

            private function init():void {

                comboBox.setStyle("fillColors", ["red", "haloOrange"]);

            }

        ]]>

    </mx:Script>


    <mx:Array id="arr">

        <mx:Object label="One" />

        <mx:Object label="Two" />

        <mx:Object label="Three" />

        <mx:Object label="Four" />

        <mx:Object label="Five" />

        <mx:Object label="Six" />

    </mx:Array>


    <mx:ComboBox id="comboBox"

            dataProvider="{arr}"

            creationComplete="init();" />


</mx:Application>