Color of icon when changing color of button
chromeColor
but when I do that, the icon became darker.
开发者_StackOverflow
On the left the button without changing the color, on the right, the gray button with and darker icon.
How can I have a gray button without changing the icon color ?You can do this by modifying the skin class and adding "iconDisplay" to the exclusion array. At the end the line should look like this:
static private const exclusions:Array = ["labelDisplay","iconDisplay"];
Hope this helps.
What SDK are you using? If you are in the 4.* range, then I think you should look at applying a custom skin on the button.
As said, it can be done through a custom skin. To create a custom skin with flash builder:
- Create a new package "skins" inside "src".
- Right click on skins and click on "New > MXML Skin".
- Give it a name, for instance "CustomButtonSkin".
- Pick the host component "spark.components.Button".
- Create as copy of "spark.skins.spark.ButtonSkin".
Add "iconDisplay" to the "exclusions:Array".
static private const exclusions:Array = ["labelDisplay", "iconDisplay"];
Apply the new custom skin to your buttons.
<s:Button id="MyCustomButton" skinClass="skins.CustomButtonSkin" icon="@Embed(source='...')" />
精彩评论