使 Spark ButtonBar 表现得像 mx ToggleButtonBar Flex 4
大家好,我有下面的代码在spark中定义一个按钮栏控件:
<s:ButtonBar id="tabs" y="15" left="0" height="31" change="VideosMenuBar_changeHandler(event)">
<s:ArrayCollection>
<fx:String>Latest Videos</fx:String>
<fx:String>Last Week Videos</fx:String>
<fx:String>Last Month Videos</fx:String>
</s:ArrayCollection>
</s:ButtonBar>
我有几个问题:
1)我怎样才能让这个按钮栏像mx ToggleButtonBar一样反应,即当我按下按钮两次而不丢失其状态时但只有当我按下另一个按钮时才维护它并更改?
2)如何定义默认按下的按钮?
3)最后,我在我的应用程序中应用了现成的 Flex 皮肤,这为我的按钮提供了一些悬停、选择等属性,我如何通过按钮上的新皮肤定义自己的皮肤?我可以定义新的皮肤吗?我的按钮栏的属性,以免受到皮肤中声明的属性的影响,或者我是否必须更改该皮肤中的某些内容,如何才能做到这一点?
预先非常感谢您的帮助!
Hello all i have the code below to define a buttonbar control in spark:
<s:ButtonBar id="tabs" y="15" left="0" height="31" change="VideosMenuBar_changeHandler(event)">
<s:ArrayCollection>
<fx:String>Latest Videos</fx:String>
<fx:String>Last Week Videos</fx:String>
<fx:String>Last Month Videos</fx:String>
</s:ArrayCollection>
</s:ButtonBar>
and i have a few questions about it:
1) how can i make this buttonbar react like an mx ToggleButtonBar that is when i press a button twice not to lose its state but maintain it and change only if i press another button?
2)How to define the default pressed button?
3)and lastly, i have applied a ready made skin of flex in my application and this has given my buttons some properties on hover,selected etc., how can i define my own via a new skin on my buttons?can i define new properties for my buttonbar so as not to be affected by the owns declared in the skin or do i have to change something in that skin and how can this be done?
Thanks a lot beforehand for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太确定你的意思,但你可以使用 css 更改按钮栏中按钮的外观:
s|ButtonBarButton {
皮肤等级:ClassReference("my.skin.class");
s
,您可以通过创建自己的 ButtonBarSkin 来引用您的按钮来选择自定义按钮实现。
查看 Spark 自己的 ButtonBarSkin 作为一个很好的示例,并确保这些按钮至少实现 IItemRenderer 或仅扩展 ButtonBarButton
I'm not really sure what you mean, but you can change the skins of the buttons in your button bar using css:
s|ButtonBarButton {
skin-class: ClassReference("my.skin.class");
}
Or you can choose a custom button implementation by creating your own ButtonBarSkin to refer to your buttons.
Take a look at Spark's own ButtonBarSkin for a good example and make sure these buttons at least implement IItemRenderer or just extend ButtonBarButton