Search code examples
apache-flexflex4stateskin

Flex 4 Skin:Specifying state for an attribute in script


I'm trying to create a button skin, where i can set fillColors like in a Flex 3 button, using CSS. It was easy to set the color of the gradients, by reading them from the CSS: adding a few lines in updateDisplayList: fillGradient1.color = fillColors[0]; ...

How can i set the colors for the other states, from script? I tried adding fillGradient1.color.down = fillColors[2] and it's not working...


Solution

  • in a short/fast

    read http://unitedmindset.com/jonbcampos/2009/07/02/flex-4-spark-skinning/

    at the bottom of article you'll find CSS usage, so call styles for different states - different.

    And yes you are not able to get colors from style by .state, but you could use it in skin like:

    <local:childComponent styleName.state="optional" .../>