【发布时间】:2012-03-06 09:49:26
【问题描述】:
我在 flex 中有一个选项卡式面板,其中包含各种选项卡,我使用它来获取选定的选项卡索引
private function handleInspectorAreaButtonClick(e:Event):void
{
var selectedIndex:int;
switch(Button(e.target))
{
case propertiesButton:
selectedIndex = 0;
break;
case dimensionsButton:
selectedIndex = 1;
break;
case footnotesButton:
selectedIndex = 2;
break;
case calculationsButton:
selectedIndex = 3;
break;
case whereUsedButton:
selectedIndex = 4;
break;
}
inspectorAreaViewStack.selectedIndex = selectedIndex;
}
但问题是我没有获得选定的选项卡式索引值 m 为 NULL,因此未选择选项卡这是 m 选择的面板
<s:HGroup id="inspectorAreaViewStackControls" width="100%" paddingTop="8" paddingLeft="4" paddingRight="4">
<s:Button id="property" label="Properties" click="handleInspectorAreaButtonClick(event)"/>
<s:Button id="distance" label="Dimensions" click="handleInspectorAreaButtonClick(event)"/>
</s:HGroup>
这是我要更改的视图堆栈
<mx:ViewStack id="inspectorAreaViewStack" width="100%" height="100%" paddingTop="8" paddingLeft="4" paddingRight="4" selectedIndex="0" backgroundColor="0xFFFFFF">
<s:NavigatorContent width="100%" label="propertiesContent">
<tagInspectorAspects:PropertiesAspect id="propertiesAspect"/>
</s:NavigatorContent>
<s:NavigatorContent width="100%" label="dimensionsContent">
<tagInspectorAspects:DimensionsAspect/>
</mx:ViewStack>
【问题讨论】:
-
你能发布完整的代码吗?以及在 switch case 用例属性中:而不是 case propertiesButton:
-
@rajesh.adhi 我编辑了代码,这就是我所拥有的
-
Librak,你找到了哪个解决方案?
标签: apache-flex flex4