Groups | Blog | Home
all groups > flash actionscript > january 2005 >

flash actionscript : Coloring the active header of Accordion?


Zal
1/27/2005 9:41:15 PM
Hi everyone, I finally found the way to change the fontSize of the labels in
the accordion component. _global.styles.AccordionHeader.setStyle('fontSize',
17); Now I have to set a different color of it if it's open or not. Didn't find
anything..... I found the path of the textField of it:
myComp._header0.labelPath but ain't able to change its color..... ??? Any clue?
Thanks!!
Ganesh GV
1/28/2005 5:35:01 AM
try this.. _global.styles.AccordionHeader.setStyle('color',0x00ffff); or if
u want to change the AccordionHeader backgroung color then u create a movieclip
and name its linkage identifier as 'AccordionHeaderSkin'. so whatever is inside
that movieclip will come as the header background.
Zal
1/28/2005 4:51:56 PM
No. That.s not it. This way, every headers receive the change of color. What I
want is just the opened 'panel' to have a different color. I found the way to
trap the event for this with the following code, but ain't able to distinclivly
change the style of the opened header

myAccordionListener = new Object();
myAccordionListener.change = function(){
// . . . change to the default color the previously opened header
// . . . change the newly opened header to the appropriate style (font
color....)
}
myAccordion.addEventListener("change", myAccordionListener);
Zal
1/28/2005 6:44:29 PM
Got it! Tanks to the Flash coder's best friend: trace() ! (maybe this code
could be optimized . . . ) ciao!

// the first pane is open at first:
var previousIndex:Number = 0;
// Set the color of the 1st header:
myAccordion["_header"+_level0.previousIndex].labelPath.setStyle("color",
0xffffff);
// create a listening object for the chage event of my accordion:
myAccordionListener = new Object();
myAccordionListener.change = function(){
myAccordion["_header"+_level0.previousIndex].labelPath.setStyle("color",
0x000000);
previousIndex = _level0.myAccordion.selectedIndex;
myAccordion["_header"+_level0.previousIndex].labelPath.setStyle("color",
0xffffff);
}
// Plug the object to the event:
myAccordion.addEventListener("change", myAccordionListener);
AddThis Social Bookmark Button