I’m trying to style the Accordion headers using CSS and the headerStyleName property in Flex 4.5, but the CSS styles are not displaying. The accordion headers appear the same as the default style. Here’s my current code.
Accordion.css:
.accHeader {
fillColors: #dbf6c6, #e1facd;
fillAlphas: 1.0, 0.5;
}
MXML code from the component (not the main application):
...
<fx:Style source="skins/Accordion.css" />
<mx:Accordion left="0" right="0" top="0" bottom="0" id="geo_accordion"
openDuration="500" headerStyleName="accHeader">
...
I’ve also tried embedding the CSS inside the style tag instead of linking to an external CSS file, but the results are the same.
Also, if I change a different CSS property, such as color, the change is correctly displayed.
I know about the chromeColor property as well, but it is the not the look I’m trying to achieve. I’m also not completely set on using CSS, so if there another better way to achieve a customizable Accordion header, I’m all for it. I was initially going to make a skin, but stopped when I didn’t see the correct host component in the New MXML Skin dialog.
Any information to point me in the right direction would be very much appreciated. Thank you for your time!
Sweet victory!
I was able to successfully skin the Accordion header using flexlib and creating a custom skin based on the
AccordionHeaderSkin.mxmlfound in the source of the Flex 4.5 SDK. I made aCanvasButtonAccordionHeaderfor the header renderer and set the skin for that to the new custom skin.Here’s the code for the
AccordionHeaderSkin.mxml(not my final style, but a working editable skin):Then here’s the renderer (
AccordionHeader.mxml):And here’s my Accordion:
<mx:Accordion left="0" right="0" top="0" bottom="0" id="geo_accordion" openDuration="500" headerRenderer="AccordionHeader">