views:

69

answers:

1

Hi All,

I'm trying to add a cancel icon to my TabBarButtons in Flex 4.0 (Spark), and I've gotten close, but now I'm stuck on getting the icon to be "clickable"

I have seen other approaches, like FlexWiz Blog (http://flexwiz.amosl.com/flex/spark-tabs-with-close-button/), but was hoping to figure out something cleaner.

Using the similar approach found in the Tour de Flex sample on Tabbed Navigation, here is what I have in my skin so far:

<s:HGroup top="5" right="5" left="5" verticalAlign="middle">        
        <s:Label id="labelDisplay"
                 textAlign="left"
                 maxDisplayedLines="1"
                 top="10"
                 width="100%">
        </s:Label>      

        <s:Graphic x="16" y="16" 
                   buttonMode="true" 
                   mouseEnabledWhereTransparent="false" 
                   useHandCursor="true"  
                   click="closeEmployeeButtonClicked()"
                   color="0x00FF00">
            <s:BitmapImage source="@Embed('assets/images/icons/close.png')"                            
                           height="16" width="16" fillMode="scale"/>
        </s:Graphic>
</s:HGroup>

The icon appears in the tab, however, I can't click it. I also tried a button and it's almost like the parent button container does not allow the child to be clickable. I did play with some parent properties (like super.mouseChildren), but couldn't get it to work.

Any thoughts!

Kind regards, =Dave

A: 

It's already done in flexlib library. You can find some examples here:

http://flexlib.googlecode.com/svn/trunk/examples/SuperTabNavigator_Sample.swf

and here is its project home page:

http://code.google.com/p/flexlib/

2DH
Good idea, but the SuperTabNavigator is based on mx (Flex 3) components. The question is specific to Flex 4 spark components and skins.
Wade Mueller
Oh yeah, you're right. Sorry for that. I was using this lib in my Flex 3 project and noticed that there was also Flex 4 version, so I thought that they rewrote it all for Flex 4. Oh naive me ;) Anyway Dave can still use that as an example of how he can solve some problems that may come out.
2DH
Yes, good idea, thank you! I'll take a look at how SuperTabNavigator was built. I am also trying to stay away from 3rd party components, to see if it can be done just using the skin in Flex 4. Thanks!
Dave Meurer