Search code examples
user-interfaceapache-flexflex4flex-spark

Flex: setting disabled color of dropdownlist


I would like to disable a spark drop down list but do not want to have the alpha color over it. I want the color to stay exactly the same. (by user requirements)

I have this code but the disabled color is still the standard disabled color.

mydropdown.enabled = false; mydropdown.setStyle("disabledColor", 0xFFFFFF);

Am I missing something?

Thanks Richard


Solution

  • DropDownList is different from DateField as it is spark vs mx. So you will want to set a custom skinClass for the DropDownList.

    Create a copy of DropDownListSkin, Then remove the alpha.disabled=".5" from the top tag.

    mydropdown.setStyle("skinClass", MyDropDownSkin);
    

    Edit Adding an alternative You can also wrap the dropdown in a group with the style disabledAlpha set to 1

    <s:Group disabledAlpha="1" enabled="false">
        <s:DropDownList />      
    </s:Group>