0

I have a mx Tab navigator and added several childs...I can use selectedindex(int) to open/select the respective (int) tab but How do I know the value of a selected/open tab???

Any Ideas.

Please help

2 Answers 2

1

You mean the navigator content?

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx"
               minWidth="955"
               minHeight="600">


    <fx:Script>
        <![CDATA[
            import mx.core.INavigatorContent;
            import mx.events.IndexChangedEvent;

            protected function tabNavigator_changeHandler(event:IndexChangedEvent):void
            {
                var obj:INavigatorContent = tabNavigator.selectedChild;
            }
        ]]>
    </fx:Script>

    <mx:TabNavigator id="tabNavigator"
                     change="tabNavigator_changeHandler(event)" />

</s:Application>
3
  • NO, If we do this <mx: TabNavigator id =tabs"> tabs.selectedIndex = 2; we focus/open/select the tab no. 2.... Oct 18, 2011 at 16:55
  • Now if there are 6 tabs and user switches a to a tab how to determine which tabindex is now selected/opened/focused Oct 18, 2011 at 16:57
  • oh, you said: "I can use selectedindex(int)" - so you'd already solved your own problem upon post. Oct 18, 2011 at 17:35
0

You need selectedIndex property (it is readable/writable). Also see Event.CHANGED to catch tab change.

2
  • To select/open/focus on no. 2 tab we use tabs.selectedIndex=2; where tabs is the id of tab navigator. Can we do this too var asd:int = tabs.selectIndex; Oct 18, 2011 at 17:01
  • Ya done..Thanks I overlooked that selectedIndex was readable/writable Oct 18, 2011 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.