I was really stuck with to change the accordian each item header color, i was trying with
1 2 |
accordion.getHeaderAt(0).setStyle("backgroundColor","red"); accordion.getHeaderAt(1).setStyle("backgroundColor","green"); |
Thanks to Peter deHaan for the post ‘Customizing the Accordion header in Flex 3′. See the example below for the Customizing the Accordion each item header background color in Flex 3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
<!--?xml version="1.0" encoding="utf-8"?--> <mx:application name="Accordion_getHeaderAt_setStyle_fillColors_test" xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalalign="middle" backgroundcolor="white"> <mx:script> [CDATA[ private function init():void { accordion.getHeaderAt(0).setStyle("fillColors", ["red", "red"]); accordion.getHeaderAt(1).setStyle("fillColors", ["haloOrange", "haloOrange"]); accordion.getHeaderAt(2).setStyle("fillColors", ["yellow", "yellow"]); accordion.getHeaderAt(3).setStyle("fillColors", ["haloGreen", "haloGreen"]); accordion.getHeaderAt(4).setStyle("fillColors", ["haloBlue", "haloBlue"]); } ]]> </mx:script> <mx:accordion id="accordion" width="300" height="200" creationcomplete="init();"> <mx:vbox label="Red"></mx:vbox> <mx:vbox label="Orange"></mx:vbox> <mx:vbox label="Yellow"></mx:vbox> <mx:vbox label="Green"></mx:vbox> <mx:vbox label="Blue"></mx:vbox> </mx:accordion> </mx:application> |