0
votes

i have a tabbed panel in the flex having various tabs and i m using this to get the selected tab index

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

but problem is that i m not getting the selected tabbed index value m getting NULL and therefore the tab is not selected this is the panel in which m selecting

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

this is my view stack which i want to change

<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>
2
can you post the complete code ? and also inside the switch case use case property: instead of case propertiesButton: - Triode
@rajesh.adhi i edited the code and this is all i have - Librak
Librak , which solution u found this? - rejo

2 Answers

0
votes
<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="Dim" click="handleInspectorAreaButtonClick(event)"/>
</s:HGroup>


private function handleInspectorAreaButtonClick(e:Event):void
        {
            var selectedIndex:int;

            switch(e.currentTarget.id)
            {
                case 'property':
                    selectedIndex = 0;
                    break;

                case 'distance':
                    selectedIndex = 1;
                    break;
            }

            inspectorAreaViewStack.selectedIndex = selectedIndex;
        }
0
votes

you can use the particular statement as follows

{ event.currentTarget.selectedIndex;

} event must be a mouse event.