Hi,
I have a repeater control which makes many buttons with toggle=true.
I would like to skin my buttons so that they look one way when they
are selected, and a diffrent way when they are not.
In my mxml, I would have a button definition like:
<mx:Button label="a button" styleName="myButton" toggle="true" />
and I define which skin to use in my stylesheet via ClassReference()
calls.
So far, I've had no problems changing the background colors/gradient,
but I'm unable to consistantly change the foreground color. I
extended the existing buttonSkin class and only made modifications to
updateDisplayList(). In this method, I tried to do something like:
if (parentButton.selected){
parentButton.setStyle("color", selectedColor);
}else{
parentButton.setStyle("color", defaultColor);
}
What actually happens is that when the button changes from off state
to on state, the text changes color. but, when untoggled, it does not
revert back to the original state. I've also noticed in the debugger
that after the button has been pressed, pressing it again does not
seem to step into the skin's code at all.
I've also tried to put setStyle commands in the case "selectedUpSkin"
section for instance, but that just seems to send this into an
infinite loop.
Any help would be much appreciated.
Thanks