I'm working on skinning the Spark:TabBar
, but am running into a snag with my custom skin used for the tabbar's buttons. Here is a diagram of what I am trying to accomplish:
_______________________
| |
| Label X |
|_____________________|
So we have a button (I'm using a custom skin on the spark:ButtonBarButton
component) that has a label and a secondary button for removing said item from the list. The X
button should only be displayed when the user hovers over the main button.
The issue I have is that I am completely unable to interact with the X
button, because it is a button within a button. It does not respond to hover states, and any click handlers I attach to it do not fire - instead the parent button's click events fire.
I'm currently toying around with using stopPropagation
, but that won't (or rather I don't expect it to) fix the hover state issues, and am looking for a more feasible solution.
Here are some examples of my code:
VerticalPillBarSkin - hostComponent: 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 - note that SymbolButton
is a custom component extending 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()" />
Does anyone know of a good way around this issue? I had played with using something other than s:ButtonBarButton
as the VerticalPillBarButton
, but that doesn't seem to be a working option. If there is any other information I can provide, please feel free to ask.