ToggleButtonBar - 如何仅更改一个按钮的颜色
我有一个tooglebuttonbar(有4个按钮),我想根据特定数据仅更改一个或两个按钮的颜色。 有人有经验可以做到这一点吗?
我尝试这样做
var child:Button;
child = Button(tbbAction2.getChildAt(0));
child.setStyle('color', '#CC33CC');
但是没有效果。
I have a tooglebuttonbar (with 4 buttons) and I'd like to change the color of only one or two button according particular data.
Is someone has experience to do that.
I try to do like that
var child:Button;
child = Button(tbbAction2.getChildAt(0));
child.setStyle('color', '#CC33CC');
But there's no effect.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您需要扩展 ToggleButtonBar 和/或皮肤。在皮肤中,您应该能够检查数据并根据数据值显示颜色。或者在皮肤中创建具有您想要的颜色的第二个状态。根据您的价值观,您将切换到第二种状态。
It sounds like you'll need to extend ToggleButtonBar and / or the skins. In the skin you should be able to check the data and display the color based on the value of the data. Or create a second state in the skin that has the color you want. Depending on your values you would switch to the second state.