Actionscript 3 按钮栏能否仅显示其提供的Viewstack的某些内容?
按钮栏是否可能仅显示viewstack中的某些导航器内容。比如说,我只想让按钮栏显示前两个按钮,而不是第三个Actionscript 3 按钮栏能否仅显示其提供的Viewstack的某些内容?,actionscript-3,apache-flex,flex4.6,Actionscript 3,Apache Flex,Flex4.6,按钮栏是否可能仅显示viewstack中的某些导航器内容。比如说,我只想让按钮栏显示前两个按钮,而不是第三个 <s:ButtonBar dataProvider="{mainViewStack}"/> <mx:ViewStack id="mainViewStack"> <s:NavigatorContent> </s:NavigatorContent> <s:NavigatorContent> </s:NavigatorC
<s:ButtonBar dataProvider="{mainViewStack}"/>
<mx:ViewStack id="mainViewStack">
<s:NavigatorContent>
</s:NavigatorContent>
<s:NavigatorContent>
</s:NavigatorContent>
<s:NavigatorContent>
</s:NavigatorContent>
</mx:ViewStack>
我也有类似的问题,没有找到本机解决方案。所以我写了下一个“黑客”。 编写了自己的扩展NavitagorContent的类 ExtNavigatorContent.as
public class ExtNavigationContent extends NavigatorContent
{
public function ExtNavigationContent()
{
super();
}
private var _includeInBar:Boolean = true;
public function get includeInBar():Boolean
{
return _includeInBar;
}
public function set includeInBar(value:Boolean):void
{
_includeInBar = value;
dispatchEvent(new Event("labelChanged"));
}
}
我为TabBar创建了新的皮肤(在您的情况下,它将是ButtonBar)。然后,在标准蒙皮中添加下一步(而不是创建默认按钮):
最后,声明TabBar/ButtonBar:
<s:TabBar id="menu" dataProvider="{viewstack1}" skinClass="design.skins.tabbar.SimpleTabBarSkin"/>
<mx:ViewStack id="viewstack1" width="100%" height="100%">
<components:ExtNavigationContent includeInBar="false" />
<components:ExtNavigationContent includeInBar="true" />
<components:ExtNavigationContent />
</mx:ViewStack>
谢谢您的回答,如果对我有效,我会尝试并给您反馈。:)希望有一个更简单的解决方案,啊,好吧。我不能让这个工作…我只是想尝试一个不同的方法来实现我的目标。对不起,我给出了错误的例子。我会更新答案。如果您对我的解决方案有疑问,请写信给我,我会尽力帮助您。
<s:TabBar id="menu" dataProvider="{viewstack1}" skinClass="design.skins.tabbar.SimpleTabBarSkin"/>
<mx:ViewStack id="viewstack1" width="100%" height="100%">
<components:ExtNavigationContent includeInBar="false" />
<components:ExtNavigationContent includeInBar="true" />
<components:ExtNavigationContent />
</mx:ViewStack>