cssflashapache-flexflex-mx

Set Flex MX Button background color using CSS


Using CSS, how do I set the background color of a Flex MX Button? My button is declared as:

<mx:Button label="My Button"/>

And the CSS is:

@namespace mx "library://ns.adobe.com/flex/mx";

mx|Button {
    color: #66ffff;
    backgroundColor: #333333;
}

backgroundColor doesn't seem to be the correct CSS property for MX Button's background color. Looking at the Flex API docs, I tried fillColors but that didn't do anything.

Is it possible to change mx.controls.Button's background color using CSS?


Solution

  • try

    Button {
       fillAlphas: 1, 1, 1, 1;
       fillColors: #66ffff, #66ffff, #66ffff, #66ffff;
    }
    

    Even if i'd try to use an external .css file

    You can create it with Flex Style Explorer and import it by the following statement:

    <mx:Style source="yourstylesheet.css" />