开发者

Change Label Color on Button States (FLex 4)

I have a button in my application and I want it to respond a bit in a special way. Initiall开发者_如何学Goy the label color of the button is White, I want the color of the text to change to 50% white on the Over State and to 25% on the Down state. Is this possible?

I tried an alternative way using css which does not do the percentage stuff but only changes the color (see css code below), but this does not seem to work. I more specifically want the color to change in terms of percentage like I mentioned above. Can someone help on this one pls?

Note that I am using the Skin file only to loads images for each state on the button.

s|Button#specialButton {
 downSkin: Embed(source="text.swf", symbol="btn_focus");
 overSkin: Embed(source="text.swf", symbol="btn_hover");
 upSkin: Embed(source="text.swf", symbol="btn_normal");
 disabledSkin: Embed(source="menuButtons.swf", symbol="btn_disabled");
 skinClass: ClassReference("specialbuttonSkin");
 color:#ffffff;
 textRollOverColor: #ffffff;
 textSelectedColor: #d0d0d0;
}

Thanks for your help.


Here's how I would do it: Set the text alpha based on the current state. The easiest way to achieve this is to set it up in MXML when declaring the instance of your button, like so:

<s:Button label="My Button" textAlpha.over="0.5" textAlpha.down="0.25"/>

Hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜