【发布时间】:2013-10-29 19:28:37
【问题描述】:
我正在为Spark:TabBar 设置皮肤,但我的自定义皮肤用于标签栏按钮时遇到了障碍。这是我想要完成的图表:
_______________________
| |
| Label X |
|_____________________|
所以我们有一个按钮(我在spark:ButtonBarButton 组件上使用自定义皮肤),它有一个标签和一个辅助按钮,用于从列表中删除所述项目。 X 按钮应仅在用户将鼠标悬停在主按钮上时显示。
我遇到的问题是我完全无法与X 按钮交互,因为它是按钮中的一个按钮。它不响应悬停状态,并且我附加到它的任何点击处理程序都不会触发 - 而是触发父按钮的点击事件。
我目前正在尝试使用stopPropagation,但这不会(或者说我不希望它)解决悬停状态问题,并且正在寻找更可行的解决方案。
以下是我的一些代码示例:
VerticalPillBarSkin - 主机组件:spark.components.TabBar
<s:DataGroup id="dataGroup" width="100%" height="100%" clipAndEnableScrolling="true">
<s:layout>
<s:VerticalLayout paddingRight="3" gap="3"/>
</s:layout>
<s:itemRenderer>
<fx:Component>
<s:ButtonBarButton skinClass="{VerticalPillBarButtonSkin}" width="120"/>
</fx:Component>
</s:itemRenderer>
</s:DataGroup>
VerticalPillBarButtonSkin - 请注意,SymbolButton 是扩展 ButtonBase 的自定义组件。
<s:Label id="labelDisplay" color="0x000000"
textAlign="left" verticalAlign="middle"
horizontalCenter="0" verticalCenter="1"
left="0" right="12" top="6" bottom="6" />
<s:Spacer width="100%" />
<x:SymbolButton id="removeButton"
includeIn="overStates"
icon="{REMOVE}"
iconRollover="{REMOVE_OVER}"
right="5" verticalCenter="0" click="closeHandler()" />
有没有人知道解决这个问题的好方法?我曾尝试使用s:ButtonBarButton 以外的其他东西作为VerticalPillBarButton,但这似乎不是一个可行的选择。如果有任何其他信息我可以提供,请随时询问。
【问题讨论】:
标签: apache-flex mxml flex-spark