首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Trigger ButtonBar单击

Trigger ButtonBar单击
EN

Stack Overflow用户
提问于 2012-03-09 05:20:06
回答 1查看 458关注 0票数 0

我的皮肤有点怪怪的。我希望通过触发sparks按钮按钮来解决这个问题,但我不太确定该怎么做。

这是我的按钮条形码

代码语言:javascript
复制
<s:ButtonBar id="tabs" dataProvider="{vs}"
             skinClass="skins.hatchedbuttonbarskins.TabBarSkin" 
             depth="100" width="80%" visible="true" 
             bottom="0" horizontalCenter="0" height="25" />
<mx:ViewStack id="vs" width="95%" height="625" 
              borderVisible="true" horizontalCenter="0">
    <s:NavigatorContent width="80%" height="100%" 
                        label="My Label" 
                        skinClass="skins.lg.TabNavigatorContent">
        <lists:ListCenter myLists="{this}" myButtons="{tabs}"/>
    </s:NavigatorContent>
...

在这个之后还有另外三个navigatorcontent对象。

在ListCenter.mxml中,我想触发选项卡按钮栏按钮的单击。这是我正在进行的动作脚本调用。

代码语言:javascript
复制
myButtons[1].dispatchEvent(new MouseEvent(MouseEvent.CLICK));

它给了我以下错误:

代码语言:javascript
复制
Error #1069: Property 1 not found on spark.components.ButtonBar and there is no default value.

如何访问按钮对象?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-03-09 06:53:15

我不确定您想要实现什么,但您可以尝试像这样更改ButtonBar.selectedIndex:

代码语言:javascript
复制
myButtons.selectedIndex = 1;

如果您确实想访问按钮,请使用:

代码语言:javascript
复制
var btnBarBtn:ButtonBarButton = myButtons.dataGroup.getElementAt(0) as ButtonBarButton;

或者你可以描述你的皮肤问题,也许有另一种方法解决它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9625090

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档