0 Replies Latest reply on Apr 19, 2010 2:51 PM by benkat.reddy

    dispatch an event within a tab to another tab in tabnavigator

    benkat.reddy

      Hi

      I need help in figuring this

      I have a tabnavigator with 2 NavigatorContents as below

      <mx:TabNavigator id="main" x="95" y="94" width="200" height="200">
                      <s:NavigatorContent id="tab1N" label="tab1" width="100%"
      height="100%">
                              <tabs:tab1 id="tab11"/>
                      </s:NavigatorContent>
                      <s:NavigatorContent id="tab2N" label="tab2" width="100%"
      height="100%">
                              <tabs:tab2 id="tab22"/>
                      </s:NavigatorContent>
      </mx:TabNavigator>

      now I have defined 2 components as below

      tab1:
      ==================
      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
              <fx:Declarations>
                      <!-- Place non-visual elements (e.g., services, value objects) here
      -->
              </fx:Declarations>
              <s:Button id="tab1button" label="tab1" />
      </s:Group>

      tab2:
      ==================
      <?xml version="1.0" encoding="utf-8"?>
      <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
                       xmlns:s="library://ns.adobe.com/flex/spark"
                       xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300">
              <fx:Declarations>
                      <!-- Place non-visual elements (e.g., services, value objects) here
      -->
              </fx:Declarations>

              <s:Button id="tab2button" label="tab2" />
      </s:Group>

      Now my requirement is, when I click on tab1button, it should change
      the focus to tab2 navigatorcontent and vice versa, i.e clicking on
      tab2button should change the focus to tab1 naigatorcontent.

      If I place the buttons directly instead of include components, it
      works using main.selectedIndex=1 on button click action, but my real-
      time project has a much bigger code which I can't place.

      I am new to flex and would be thankful if anyone can help me here.

      Thx
      Pradp