Flex Spark:如何在 TabBar 按钮上添加取消按钮?

发布于 2024-09-14 19:13:44 字数 1415 浏览 5 评论 0原文

我正在尝试在 Flex 4.0 (Spark) 中向我的 TabBarButtons 添加取消图标,并且已经接近了,但现在我坚持让图标“可点击”,

我已经看到了其他方法,例如 FlexWiz Blog (http://flexwiz.amosl.com/flex/spark- tabs-with-close-button/),但希望找到更干净的东西。

使用 中找到的类似方法选项卡式导航上的 Tour de Flex 示例,这是到目前为止我的皮肤中的内容:

<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>

图标出现在选项卡中,但是我无法单击它。我还尝试了一个按钮,它几乎就像父按钮容器不允许子按钮可单击。我确实使用了一些父属性(如 super.mouseChildren),但无法让它工作。

有什么想法!

亲切的问候, =戴夫

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

泡沫很甜 2024-09-21 19:13:44

我看到这篇文章很旧了,但我刚刚遇到了同样的问题。
为了使按钮可单击,您需要在 TabBarButtonSkin 上启用 mouseChildren。您可以按如下方式进行操作:

override protected function commitProperties():void
{
    super.commitProperties();
    hostComponent.mouseChildren = true;
}

现在您的按钮应该是可单击的。至少它对我有用。

I see that the post is pretty old, but I just came along the same issue.
In order for button to be clickable, you need to enable mouseChildren at a TabBarButtonSkin. You can do it as follows:

override protected function commitProperties():void
{
    super.commitProperties();
    hostComponent.mouseChildren = true;
}

Now your button should be clickable. At least it worked for me.

但可醉心 2024-09-21 19:13:44

它已经在 flexlib 库中完成了。您可以在此处找到一些示例:

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

这是其项目主页:

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

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/

柠檬色的秋千 2024-09-21 19:13:44

这是一个基于 Flex 4 的选项卡控件,看起来做得非常好,包含完整源代码:

http ://saturnboy.com/2010/08/terrifictabbar-custom-component/

Here's a Flex 4 based tab control that appears to be very well done, full source included:

http://saturnboy.com/2010/08/terrifictabbar-custom-component/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文