3

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?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Steve Kuo
  • 61,876
  • 75
  • 195
  • 257

1 Answers1

3

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" />
Fseee
  • 2,476
  • 9
  • 40
  • 63
  • I actually tried `fillColors` but with only 2 values. Adobe's own mx Button docs (http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/Button.html) appears to be incorrect in that it shows fillColors with only 2 values. 4 works, 2 does not. – Steve Kuo Apr 08 '11 at 23:07